Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
GrXPFactory Class Referenceabstract

#include <GrXferProcessor.h>

Inheritance diagram for GrXPFactory:
CustomXPFactory GrCoverageSetOpXPFactory GrDisableColorXPFactory GrPorterDuffXPFactory

Public Types

enum class  AnalysisProperties : unsigned {
  kNone = 0x0 , kReadsDstInShader = 0x1 , kCompatibleWithCoverageAsAlpha = 0x2 , kIgnoresInputColor = 0x4 ,
  kRequiresDstTexture = 0x10 , kRequiresNonOverlappingDraws = 0x20 , kUsesNonCoherentHWBlending = 0x40 , kUnaffectedByDstValue = 0x80
}
 

Public Member Functions

 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (AnalysisProperties)
 

Static Public Member Functions

static sk_sp< const GrXferProcessorMakeXferProcessor (const GrXPFactory *, const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &caps, GrClampType)
 
static AnalysisProperties GetAnalysisProperties (const GrXPFactory *, const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage &, const GrCaps &, GrClampType)
 
static const GrXPFactoryFromBlendMode (SkBlendMode)
 

Protected Member Functions

constexpr GrXPFactory ()
 

Private Member Functions

virtual sk_sp< const GrXferProcessormakeXferProcessor (const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &, GrClampType) const =0
 
virtual AnalysisProperties analysisProperties (const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage &, const GrCaps &, GrClampType) const =0
 

Detailed Description

We install a GrXPFactory (XPF) early on in the pipeline before all the final draw information is known (e.g. whether there is fractional pixel coverage, will coverage be 1 or 4 channel, is the draw opaque, etc.). Once the state of the draw is finalized, we use the XPF along with all the draw information to create a GrXferProcessor (XP) which can implement the desired blending for the draw.

Before the XP is created, the XPF is able to answer queries about what functionality the XPs it creates will have. For example, can it create an XP that supports RGB coverage or will the XP blend with the destination color.

GrXPFactories are intended to be static immutable objects. We pass them around as raw pointers and expect the pointers to always be valid and for the factories to be reusable and thread safe. Equality is tested for using pointer comparison. GrXPFactory destructors must be no-ops.

Definition at line 202 of file GrXferProcessor.h.

Member Enumeration Documentation

◆ AnalysisProperties

enum class GrXPFactory::AnalysisProperties : unsigned
strong
Enumerator
kNone 
kReadsDstInShader 

The fragment shader will require the destination color.

kCompatibleWithCoverageAsAlpha 

The op may apply coverage as alpha and still blend correctly.

kIgnoresInputColor 

The color input to the GrXferProcessor will be ignored.

kRequiresDstTexture 

The destination color will be provided to the fragment processor using a texture. This is additional information about the implementation of kReadsDstInShader.

kRequiresNonOverlappingDraws 

If set, each pixel can only be touched once during a draw (e.g., because we have a dst texture or because we need an xfer barrier).

kUsesNonCoherentHWBlending 

If set the draw will use fixed function non coherent advanced blends.

kUnaffectedByDstValue 

If set, the existing dst value has no effect on the final output.

Definition at line 204 of file GrXferProcessor.h.

204 : unsigned {
205 kNone = 0x0,
206 /**
207 * The fragment shader will require the destination color.
208 */
209 kReadsDstInShader = 0x1,
210 /**
211 * The op may apply coverage as alpha and still blend correctly.
212 */
213 kCompatibleWithCoverageAsAlpha = 0x2,
214 /**
215 * The color input to the GrXferProcessor will be ignored.
216 */
217 kIgnoresInputColor = 0x4,
218 /**
219 * The destination color will be provided to the fragment processor using a texture. This is
220 * additional information about the implementation of kReadsDstInShader.
221 */
222 kRequiresDstTexture = 0x10,
223 /**
224 * If set, each pixel can only be touched once during a draw (e.g., because we have a dst
225 * texture or because we need an xfer barrier).
226 */
227 kRequiresNonOverlappingDraws = 0x20,
228 /**
229 * If set the draw will use fixed function non coherent advanced blends.
230 */
231 kUsesNonCoherentHWBlending = 0x40,
232 /**
233 * If set, the existing dst value has no effect on the final output.
234 */
235 kUnaffectedByDstValue = 0x80,
236 };
@ kNone
Definition: layer.h:53

Constructor & Destructor Documentation

◆ GrXPFactory()

constexpr GrXPFactory::GrXPFactory ( )
inlineconstexprprotected

Definition at line 254 of file GrXferProcessor.h.

254{}

Member Function Documentation

◆ analysisProperties()

virtual AnalysisProperties GrXPFactory::analysisProperties ( const GrProcessorAnalysisColor ,
const GrProcessorAnalysisCoverage ,
const GrCaps ,
GrClampType   
) const
privatepure virtual

Subclass analysis implementation. This should not return kNeedsDstInTexture as that will be inferred by the base class based on kReadsDstInShader and the caps.

◆ FromBlendMode()

const GrXPFactory * GrXPFactory::FromBlendMode ( SkBlendMode  mode)
static

Definition at line 102 of file GrXferProcessor.cpp.

102 {
103 if (SkBlendMode_AsCoeff(mode, nullptr, nullptr)) {
106 return result;
107 }
108
111}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff *src, SkBlendModeCoeff *dst)
Definition: SkBlendMode.cpp:57
static const GrXPFactory * Get(SkBlendMode blendMode)
GAsyncResult * result
bool IsSupportedMode(SkBlendMode mode)
const GrXPFactory * Get(SkBlendMode mode)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ GetAnalysisProperties()

GrXPFactory::AnalysisProperties GrXPFactory::GetAnalysisProperties ( const GrXPFactory factory,
const GrProcessorAnalysisColor color,
const GrProcessorAnalysisCoverage coverage,
const GrCaps caps,
GrClampType  clampType 
)
static

Definition at line 66 of file GrXferProcessor.cpp.

71 {
73 if (factory) {
74 result = factory->analysisProperties(color, coverage, caps, clampType);
75 } else {
77 }
80 }
86 }
87 return result;
88}
const GrShaderCaps * shaderCaps() const
Definition: GrCaps.h:63
static AnalysisProperties SrcOverAnalysisProperties(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage &, const GrCaps &, GrClampType)
virtual AnalysisProperties analysisProperties(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage &, const GrCaps &, GrClampType) const =0
DlColor color
bool fDstReadInShaderSupport
Definition: GrShaderCaps.h:34

◆ GR_DECL_BITFIELD_CLASS_OPS_FRIENDS()

GrXPFactory::GR_DECL_BITFIELD_CLASS_OPS_FRIENDS ( AnalysisProperties  )

◆ makeXferProcessor()

virtual sk_sp< const GrXferProcessor > GrXPFactory::makeXferProcessor ( const GrProcessorAnalysisColor ,
GrProcessorAnalysisCoverage  ,
const GrCaps ,
GrClampType   
) const
privatepure virtual

◆ MakeXferProcessor()

sk_sp< const GrXferProcessor > GrXPFactory::MakeXferProcessor ( const GrXPFactory factory,
const GrProcessorAnalysisColor color,
GrProcessorAnalysisCoverage  coverage,
const GrCaps caps,
GrClampType  clampType 
)
static

Definition at line 90 of file GrXferProcessor.cpp.

94 {
95 if (factory) {
96 return factory->makeXferProcessor(color, coverage, caps, clampType);
97 } else {
99 }
100}
static sk_sp< const GrXferProcessor > MakeSrcOverXferProcessor(const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &)
virtual sk_sp< const GrXferProcessor > makeXferProcessor(const GrProcessorAnalysisColor &, GrProcessorAnalysisCoverage, const GrCaps &, GrClampType) const =0

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