Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
GrXferProcessor Class Referenceabstract

#include <GrXferProcessor.h>

Inheritance diagram for GrXferProcessor:
GrProcessor GrNonAtomicRef< GrXferProcessor > SkNoncopyable CoverageSetOpXP CustomXP DisableColorXP PDLCDXferProcessor PorterDuffXferProcessor ShaderPDXferProcessor

Classes

class  ProgramImpl
 

Public Member Functions

void addToKey (const GrShaderCaps &, skgpu::KeyBuilder *, const GrSurfaceOrigin *originIfDstTexture, bool usesInputAttachmentForDstRead) const
 
virtual std::unique_ptr< ProgramImplmakeProgramImpl () const =0
 
virtual GrXferBarrierType xferBarrierType (const GrCaps &caps) const
 
skgpu::BlendInfo getBlendInfo () const
 
bool willReadDstColor () const
 
bool hasSecondaryOutput () const
 
bool isLCD () const
 
bool isEqual (const GrXferProcessor &that) const
 
- Public Member Functions inherited from GrProcessor
virtual ~GrProcessor ()=default
 
virtual const char * name () const =0
 
void * operator new (size_t size)
 
void * operator new (size_t object_size, size_t footer_size)
 
void operator delete (void *target)
 
void * operator new (size_t size, void *placement)
 
void operator delete (void *target, void *placement)
 
template<typename T >
const Tcast () const
 
ClassID classID () const
 
- Public Member Functions inherited from GrNonAtomicRef< GrXferProcessor >
 GrNonAtomicRef ()
 
bool unique () const
 
int refCnt () const
 
void ref () const
 
void unref () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Protected Member Functions

 GrXferProcessor (ClassID classID)
 
 GrXferProcessor (ClassID classID, bool willReadDstColor, GrProcessorAnalysisCoverage)
 
- Protected Member Functions inherited from GrProcessor
 GrProcessor (ClassID classID)
 
 GrProcessor (const GrProcessor &)=delete
 
GrProcessoroperator= (const GrProcessor &)=delete
 

Private Member Functions

virtual void onAddToKey (const GrShaderCaps &, skgpu::KeyBuilder *) const =0
 
virtual bool onHasSecondaryOutput () const
 
virtual void onGetBlendInfo (skgpu::BlendInfo *) const
 
virtual bool onIsEqual (const GrXferProcessor &) const =0
 

Additional Inherited Members

- Public Types inherited from GrProcessor
enum  ClassID {
  kNull_ClassID , kAttributeTestProcessor_ClassID , kBigKeyProcessor_ClassID , kBlendFragmentProcessor_ClassID ,
  kBlockInputFragmentProcessor_ClassID , kButtCapStrokedCircleGeometryProcessor_ClassID , kCircleGeometryProcessor_ClassID , kCircularRRectEffect_ClassID ,
  kClockwiseTestProcessor_ClassID , kColorTableEffect_ClassID , kCoverageSetOpXP_ClassID , kCustomXP_ClassID ,
  kDashingCircleEffect_ClassID , kDashingLineEffect_ClassID , kDefaultGeoProc_ClassID , kDeviceSpace_ClassID ,
  kDIEllipseGeometryProcessor_ClassID , kDisableColorXP_ClassID , kDrawAtlasPathShader_ClassID , kEllipseGeometryProcessor_ClassID ,
  kEllipticalRRectEffect_ClassID , kFwidthSquircleTestProcessor_ClassID , kGP_ClassID , kGrBicubicEffect_ClassID ,
  kGrBitmapTextGeoProc_ClassID , kGrColorSpaceXformEffect_ClassID , kGrConicEffect_ClassID , kGrConvexPolyEffect_ClassID ,
  kGrDiffuseLightingEffect_ClassID , kGrDisplacementMapEffect_ClassID , kGrDistanceFieldA8TextGeoProc_ClassID , kGrDistanceFieldLCDTextGeoProc_ClassID ,
  kGrDistanceFieldPathGeoProc_ClassID , kGrFillRRectOp_Processor_ClassID , kGrGaussianConvolutionFragmentProcessor_ClassID , kGrMatrixConvolutionEffect_ClassID ,
  kGrMatrixEffect_ClassID , kGrMeshTestProcessor_ClassID , kGrMorphologyEffect_ClassID , kGrPerlinNoise2Effect_ClassID ,
  kGrPipelineDynamicStateTestProcessor_ClassID , kGrQuadEffect_ClassID , kGrRRectShadowGeoProc_ClassID , kGrSkSLFP_ClassID ,
  kGrSpecularLightingEffect_ClassID , kGrTextureEffect_ClassID , kGrUnrolledBinaryGradientColorizer_ClassID , kGrYUVtoRGBEffect_ClassID ,
  kHighPrecisionFragmentProcessor_ClassID , kLatticeGP_ClassID , kPDLCDXferProcessor_ClassID , kPorterDuffXferProcessor_ClassID ,
  kPremulFragmentProcessor_ClassID , kQuadEdgeEffect_ClassID , kQuadPerEdgeAAGeometryProcessor_ClassID , kSeriesFragmentProcessor_ClassID ,
  kShaderPDXferProcessor_ClassID , kSurfaceColorProcessor_ClassID , kSwizzleFragmentProcessor_ClassID , kTessellate_BoundingBoxShader_ClassID ,
  kTessellate_GrModulateAtlasCoverageEffect_ClassID , kTessellate_GrStrokeTessellationShader_ClassID , kTessellate_HullShader_ClassID , kTessellate_MiddleOutShader_ClassID ,
  kTessellate_SimpleTriangleShader_ClassID , kTessellationTestTriShader_ClassID , kTestFP_ClassID , kTestRectOp_ClassID ,
  kVertexColorSpaceBenchGP_ClassID , kVerticesGP_ClassID
}
 
- Protected Attributes inherited from GrProcessor
const ClassID fClassID
 

Detailed Description

GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst color, and for applying any coverage. It does this by emitting fragment shader code and controlling the fixed-function blend state. When dual-source blending is available, it may also write a secondary fragment shader output color. GrXferProcessor has two modes of operation:

Dst read: When allowed by the backend API, or when supplied a texture of the destination, the GrXferProcessor may read the destination color. While operating in this mode, the subclass only provides shader code that blends the src and dst colors, and the base class applies coverage.

No dst read: When not performing a dst read, the subclass is given full control of the fixed- function blend state and/or secondary output, and is responsible to apply coverage on its own.

A GrXferProcessor is never installed directly into our draw state, but instead is created from a GrXPFactory once we have finalized the state of our draw.

Definition at line 69 of file GrXferProcessor.h.

Constructor & Destructor Documentation

◆ GrXferProcessor() [1/2]

GrXferProcessor::GrXferProcessor ( ClassID  classID)
protected

Definition at line 23 of file GrXferProcessor.cpp.

24 : INHERITED(classID)
25 , fWillReadDstColor(false)
26 , fIsLCD(false) {}
ClassID classID() const

◆ GrXferProcessor() [2/2]

GrXferProcessor::GrXferProcessor ( ClassID  classID,
bool  willReadDstColor,
GrProcessorAnalysisCoverage  coverage 
)
protected

Definition at line 28 of file GrXferProcessor.cpp.

30 : INHERITED(classID)
31 , fWillReadDstColor(willReadDstColor)
32 , fIsLCD(GrProcessorAnalysisCoverage::kLCD == coverage) {}
bool willReadDstColor() const

Member Function Documentation

◆ addToKey()

void GrXferProcessor::addToKey ( const GrShaderCaps caps,
skgpu::KeyBuilder b,
const GrSurfaceOrigin originIfDstTexture,
bool  usesInputAttachmentForDstRead 
) const

Adds a key on the skgpu::KeyBuilder calls onAddToKey(...) to get the specific subclass's key.

Definition at line 41 of file GrXferProcessor.cpp.

44 {
45 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0;
46 if (key) {
47 if (originIfDstTexture) {
48 key |= 0x2;
49 if (kTopLeft_GrSurfaceOrigin == *originIfDstTexture) {
50 key |= 0x4;
51 }
52 if (usesInputAttachmentForDstRead) {
53 key |= 0x8;
54 }
55 }
56 }
57 if (fIsLCD) {
58 key |= 0x10;
59 }
60 b->add32(key);
61 this->onAddToKey(caps, b);
62}
@ kTopLeft_GrSurfaceOrigin
Definition GrTypes.h:148
virtual void onAddToKey(const GrShaderCaps &, skgpu::KeyBuilder *) const =0
static bool b

◆ getBlendInfo()

skgpu::BlendInfo GrXferProcessor::getBlendInfo ( ) const
inline

Definition at line 101 of file GrXferProcessor.h.

101 {
102 skgpu::BlendInfo blendInfo;
103 if (!this->willReadDstColor()) {
104 this->onGetBlendInfo(&blendInfo);
105 }
106 return blendInfo;
107 }
virtual void onGetBlendInfo(skgpu::BlendInfo *) const

◆ hasSecondaryOutput()

bool GrXferProcessor::hasSecondaryOutput ( ) const

Returns whether or not this xferProcossor will set a secondary output to be used with dual source blending.

Definition at line 34 of file GrXferProcessor.cpp.

34 {
35 if (!this->willReadDstColor()) {
36 return this->onHasSecondaryOutput();
37 }
38 return false;
39}
virtual bool onHasSecondaryOutput() const

◆ isEqual()

bool GrXferProcessor::isEqual ( const GrXferProcessor that) const
inline

Returns true if this and other processor conservatively draw identically. It can only return true when the two processor are of the same subclass (i.e. they return the same object from from getFactory()).

A return value of true from isEqual() should not be used to test whether the processor would generate the same shader code. To test for identical code generation use addToKey.

Definition at line 127 of file GrXferProcessor.h.

127 {
128 if (this->classID() != that.classID()) {
129 return false;
130 }
131 if (this->fWillReadDstColor != that.fWillReadDstColor) {
132 return false;
133 }
134 if (fIsLCD != that.fIsLCD) {
135 return false;
136 }
137 return this->onIsEqual(that);
138 }
virtual bool onIsEqual(const GrXferProcessor &) const =0

◆ isLCD()

bool GrXferProcessor::isLCD ( ) const
inline

Definition at line 117 of file GrXferProcessor.h.

117{ return fIsLCD; }

◆ makeProgramImpl()

virtual std::unique_ptr< ProgramImpl > GrXferProcessor::makeProgramImpl ( ) const
pure virtual

Returns a new instance of the appropriate GL implementation class for the given GrXferProcessor; caller is responsible for deleting the object.

Implemented in CoverageSetOpXP, CustomXP, DisableColorXP, PorterDuffXferProcessor, ShaderPDXferProcessor, and PDLCDXferProcessor.

◆ onAddToKey()

virtual void GrXferProcessor::onAddToKey ( const GrShaderCaps ,
skgpu::KeyBuilder  
) const
privatepure virtual

Adds a key on the skgpu::KeyBuilder that reflects any variety in the code that may be emitted by the xfer processor subclass.

Implemented in CoverageSetOpXP, CustomXP, DisableColorXP, PorterDuffXferProcessor, ShaderPDXferProcessor, and PDLCDXferProcessor.

◆ onGetBlendInfo()

virtual void GrXferProcessor::onGetBlendInfo ( skgpu::BlendInfo ) const
inlineprivatevirtual

If we are not performing a dst read, retrieves the fixed-function blend state required by the subclass. When using dst reads, the base class controls the fixed-function blend state and this method will not be called. The BlendInfo struct comes initialized to "no blending".

Reimplemented in CustomXP, CoverageSetOpXP, DisableColorXP, PorterDuffXferProcessor, and PDLCDXferProcessor.

Definition at line 163 of file GrXferProcessor.h.

163{}

◆ onHasSecondaryOutput()

virtual bool GrXferProcessor::onHasSecondaryOutput ( ) const
inlineprivatevirtual

If we are not performing a dst read, returns whether the subclass will set a secondary output. When using dst reads, the base class controls the secondary output and this method will not be called.

Reimplemented in PorterDuffXferProcessor.

Definition at line 156 of file GrXferProcessor.h.

156{ return false; }

◆ onIsEqual()

virtual bool GrXferProcessor::onIsEqual ( const GrXferProcessor ) const
privatepure virtual

◆ willReadDstColor()

bool GrXferProcessor::willReadDstColor ( ) const
inline

Definition at line 109 of file GrXferProcessor.h.

109{ return fWillReadDstColor; }

◆ xferBarrierType()

virtual GrXferBarrierType GrXferProcessor::xferBarrierType ( const GrCaps caps) const
inlinevirtual

Returns the barrier type, if any, that this XP will require. Note that the possibility that a kTexture type barrier is required is handled by the GrPipeline and need not be considered by subclass overrides of this function.

Reimplemented in CustomXP.

Definition at line 97 of file GrXferProcessor.h.

97 {
99 }
@ kNone_GrXferBarrierType

The documentation for this class was generated from the following files: