Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
skgpu::BlendFormula Class Reference

#include <BlendFormula.h>

Public Types

enum  OutputType {
  kNone_OutputType , kCoverage_OutputType , kModulate_OutputType , kSAModulate_OutputType ,
  kISAModulate_OutputType , kISCModulate_OutputType , kLast_OutputType = kISCModulate_OutputType
}
 

Public Member Functions

constexpr BlendFormula (OutputType primaryOut, OutputType secondaryOut, skgpu::BlendEquation equation, skgpu::BlendCoeff srcCoeff, skgpu::BlendCoeff dstCoeff)
 
 BlendFormula (const BlendFormula &)=default
 
BlendFormulaoperator= (const BlendFormula &)=default
 
bool operator== (const BlendFormula &that) const
 
bool hasSecondaryOutput () const
 
bool modifiesDst () const
 
bool unaffectedByDst () const
 
bool unaffectedByDstIfOpaque () const
 
bool usesInputColor () const
 
bool canTweakAlphaForCoverage () const
 
skgpu::BlendEquation equation () const
 
skgpu::BlendCoeff srcCoeff () const
 
skgpu::BlendCoeff dstCoeff () const
 
OutputType primaryOutput () const
 
OutputType secondaryOutput () const
 

Detailed Description

Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage.

Definition at line 25 of file BlendFormula.h.

Member Enumeration Documentation

◆ OutputType

Values the shader can write to primary and secondary outputs. These are all modulated by coverage. We will ignore the multiplies when not using coverage.

Enumerator
kNone_OutputType 
kCoverage_OutputType 
kModulate_OutputType 
kSAModulate_OutputType 
kISAModulate_OutputType 
kISCModulate_OutputType 
kLast_OutputType 

Definition at line 31 of file BlendFormula.h.

31 {
32 kNone_OutputType, //<! 0
33 kCoverage_OutputType, //<! inputCoverage
34 kModulate_OutputType, //<! inputColor * inputCoverage
35 kSAModulate_OutputType, //<! inputColor.a * inputCoverage
36 kISAModulate_OutputType, //<! (1 - inputColor.a) * inputCoverage
37 kISCModulate_OutputType, //<! (1 - inputColor) * inputCoverage
38
40 };

Constructor & Destructor Documentation

◆ BlendFormula() [1/2]

constexpr skgpu::BlendFormula::BlendFormula ( OutputType  primaryOut,
OutputType  secondaryOut,
skgpu::BlendEquation  equation,
skgpu::BlendCoeff  srcCoeff,
skgpu::BlendCoeff  dstCoeff 
)
inlineconstexpr

Definition at line 42 of file BlendFormula.h.

47 : fPrimaryOutputType(primaryOut)
48 , fSecondaryOutputType(secondaryOut)
49 , fBlendEquation(SkTo<uint8_t>(equation))
50 , fSrcCoeff(SkTo<uint8_t>(srcCoeff))
51 , fDstCoeff(SkTo<uint8_t>(dstCoeff))
52 , fProps(GetProperties(primaryOut, secondaryOut, equation, srcCoeff, dstCoeff)) {}
skgpu::BlendEquation equation() const
Definition: BlendFormula.h:87
skgpu::BlendCoeff dstCoeff() const
Definition: BlendFormula.h:95
OutputType fSecondaryOutputType
Definition: BlendFormula.h:164
skgpu::BlendCoeff srcCoeff() const
Definition: BlendFormula.h:91
OutputType fPrimaryOutputType
Definition: BlendFormula.h:163

◆ BlendFormula() [2/2]

skgpu::BlendFormula::BlendFormula ( const BlendFormula )
default

Member Function Documentation

◆ canTweakAlphaForCoverage()

bool skgpu::BlendFormula::canTweakAlphaForCoverage ( ) const
inline

Definition at line 83 of file BlendFormula.h.

83 {
84 return SkToBool(fProps & kCanTweakAlphaForCoverage_Property);
85 }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ dstCoeff()

skgpu::BlendCoeff skgpu::BlendFormula::dstCoeff ( ) const
inline

Definition at line 95 of file BlendFormula.h.

95 {
96 return static_cast<skgpu::BlendCoeff>(fDstCoeff);
97 }
BlendCoeff
Definition: Blend.h:60

◆ equation()

skgpu::BlendEquation skgpu::BlendFormula::equation ( ) const
inline

Definition at line 87 of file BlendFormula.h.

87 {
88 return static_cast<skgpu::BlendEquation>(fBlendEquation);
89 }
BlendEquation
Definition: Blend.h:26

◆ hasSecondaryOutput()

bool skgpu::BlendFormula::hasSecondaryOutput ( ) const
inline

Definition at line 66 of file BlendFormula.h.

66 {
68 }

◆ modifiesDst()

bool skgpu::BlendFormula::modifiesDst ( ) const
inline

Definition at line 69 of file BlendFormula.h.

69 {
70 return SkToBool(fProps & kModifiesDst_Property);
71 }

◆ operator=()

BlendFormula & skgpu::BlendFormula::operator= ( const BlendFormula )
default

◆ operator==()

bool skgpu::BlendFormula::operator== ( const BlendFormula that) const
inline

Definition at line 57 of file BlendFormula.h.

57 {
58 return fPrimaryOutputType == that.fPrimaryOutputType &&
60 fBlendEquation == that.fBlendEquation &&
61 fSrcCoeff == that.fSrcCoeff &&
62 fDstCoeff == that.fDstCoeff &&
63 fProps == that.fProps;
64 }

◆ primaryOutput()

OutputType skgpu::BlendFormula::primaryOutput ( ) const
inline

Definition at line 99 of file BlendFormula.h.

99 {
100 return fPrimaryOutputType;
101 }

◆ secondaryOutput()

OutputType skgpu::BlendFormula::secondaryOutput ( ) const
inline

Definition at line 103 of file BlendFormula.h.

103 {
105 }

◆ srcCoeff()

skgpu::BlendCoeff skgpu::BlendFormula::srcCoeff ( ) const
inline

Definition at line 91 of file BlendFormula.h.

91 {
92 return static_cast<skgpu::BlendCoeff>(fSrcCoeff);
93 }

◆ unaffectedByDst()

bool skgpu::BlendFormula::unaffectedByDst ( ) const
inline

Definition at line 72 of file BlendFormula.h.

72 {
73 return SkToBool(fProps & kUnaffectedByDst_Property);
74 }

◆ unaffectedByDstIfOpaque()

bool skgpu::BlendFormula::unaffectedByDstIfOpaque ( ) const
inline

Definition at line 77 of file BlendFormula.h.

77 {
78 return SkToBool(fProps & kUnaffectedByDstIfOpaque_Property);
79 }

◆ usesInputColor()

bool skgpu::BlendFormula::usesInputColor ( ) const
inline

Definition at line 80 of file BlendFormula.h.

80 {
81 return SkToBool(fProps & kUsesInputColor_Property);
82 }

Member Data Documentation

◆ fBlendEquation

uint32_t skgpu::BlendFormula::fBlendEquation

Definition at line 165 of file BlendFormula.h.

◆ fDstCoeff

uint32_t skgpu::BlendFormula::fDstCoeff

Definition at line 167 of file BlendFormula.h.

◆ fPrimaryOutputType

OutputType skgpu::BlendFormula::fPrimaryOutputType

Definition at line 163 of file BlendFormula.h.

◆ fProps

Properties skgpu::BlendFormula::fProps

Definition at line 168 of file BlendFormula.h.

◆ fSecondaryOutputType

OutputType skgpu::BlendFormula::fSecondaryOutputType

Definition at line 164 of file BlendFormula.h.

◆ fSrcCoeff

uint32_t skgpu::BlendFormula::fSrcCoeff

Definition at line 166 of file BlendFormula.h.


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