Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
GrStrokeTessellationShader Class Reference

#include <GrStrokeTessellationShader.h>

Inheritance diagram for GrStrokeTessellationShader:
GrTessellationShader GrGeometryProcessor GrProcessor

Classes

class  Impl
 

Public Member Functions

 GrStrokeTessellationShader (const GrShaderCaps &, PatchAttribs, const SkMatrix &viewMatrix, const SkStrokeRec &, SkPMColor4f)
 
PatchAttribs attribs () const
 
bool hasDynamicStroke () const
 
bool hasDynamicColor () const
 
bool hasExplicitCurveType () const
 
const SkStrokeRecstroke () const
 
- Public Member Functions inherited from GrTessellationShader
 GrTessellationShader (ClassID classID, GrPrimitiveType primitiveType, const SkMatrix &viewMatrix, const SkPMColor4f &color)
 
GrPrimitiveType primitiveType () const
 
const SkMatrixviewMatrix () const
 
const SkPMColor4fcolor () const
 
- Public Member Functions inherited from GrGeometryProcessor
 GrGeometryProcessor (ClassID)
 
int numTextureSamplers () const
 
const TextureSamplertextureSampler (int index) const
 
int numVertexAttributes () const
 
const AttributeSetvertexAttributes () const
 
int numInstanceAttributes () const
 
const AttributeSetinstanceAttributes () const
 
bool hasVertexAttributes () const
 
bool hasInstanceAttributes () const
 
size_t vertexStride () const
 
size_t instanceStride () const
 
virtual void addToKey (const GrShaderCaps &, skgpu::KeyBuilder *) const =0
 
void getAttributeKey (skgpu::KeyBuilder *b) const
 
virtual std::unique_ptr< ProgramImplmakeProgramImpl (const GrShaderCaps &) const =0
 
- 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
 

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
}
 
- Static Public Member Functions inherited from GrTessellationShader
static const GrPipelineMakePipeline (const ProgramArgs &, GrAAType, GrAppliedClip &&, GrProcessorSet &&)
 
static GrProgramInfoMakeProgram (const ProgramArgs &args, const GrTessellationShader *shader, const GrPipeline *pipeline, const GrUserStencilSettings *stencil)
 
static const char * WangsFormulaSkSL ()
 
- Static Public Member Functions inherited from GrGeometryProcessor
static uint32_t ComputeCoordTransformsKey (const GrFragmentProcessor &fp)
 
- Static Public Attributes inherited from GrGeometryProcessor
static constexpr int kCoordTransformKeyBits = 4
 
- Protected Member Functions inherited from GrGeometryProcessor
void setVertexAttributes (const Attribute *attrs, int attrCount, size_t stride)
 
void setInstanceAttributes (const Attribute *attrs, int attrCount, size_t stride)
 
void setVertexAttributesWithImplicitOffsets (const Attribute *attrs, int attrCount)
 
void setInstanceAttributesWithImplicitOffsets (const Attribute *attrs, int attrCount)
 
void setTextureSamplerCnt (int cnt)
 
- Protected Member Functions inherited from GrProcessor
 GrProcessor (ClassID classID)
 
 GrProcessor (const GrProcessor &)=delete
 
GrProcessoroperator= (const GrProcessor &)=delete
 
- Static Protected Member Functions inherited from GrGeometryProcessor
static Attribute MakeColorAttribute (const char *name, bool wideColor)
 
- Protected Attributes inherited from GrProcessor
const ClassID fClassID
 

Detailed Description

Definition at line 24 of file GrStrokeTessellationShader.h.

Constructor & Destructor Documentation

◆ GrStrokeTessellationShader()

GrStrokeTessellationShader::GrStrokeTessellationShader ( const GrShaderCaps shaderCaps,
PatchAttribs  attribs,
const SkMatrix viewMatrix,
const SkStrokeRec stroke,
SkPMColor4f  color 
)

Definition at line 88 of file GrStrokeTessellationShader.cpp.

95 , fPatchAttribs(attribs | PatchAttribs::kJoinControlPoint)
96 , fStroke(stroke) {
97 // We should use explicit curve type when, and only when, there isn't infinity support.
98 // Otherwise the GPU can infer curve type based on infinity.
99 SkASSERT(shaderCaps.fInfinitySupport != (attribs & PatchAttribs::kExplicitCurveType));
100 // pts 0..3 define the stroke as a cubic bezier. If p3.y is infinity, then it's a conic
101 // with w=p3.x.
102 //
103 // An empty stroke (p0==p1==p2==p3) is a special case that denotes a circle, or
104 // 180-degree point stroke.
105 fAttribs.emplace_back("pts01Attr", kFloat4_GrVertexAttribType, SkSLType::kFloat4);
106 fAttribs.emplace_back("pts23Attr", kFloat4_GrVertexAttribType, SkSLType::kFloat4);
107
108 // argsAttr contains the lastControlPoint for setting up the join.
109 fAttribs.emplace_back("argsAttr", kFloat2_GrVertexAttribType, SkSLType::kFloat2);
110
111 if (fPatchAttribs & PatchAttribs::kStrokeParams) {
112 fAttribs.emplace_back("dynamicStrokeAttr", kFloat2_GrVertexAttribType,
114 }
115 if (fPatchAttribs & PatchAttribs::kColor) {
116 fAttribs.emplace_back("dynamicColorAttr",
117 (fPatchAttribs & PatchAttribs::kWideColorIfEnabled)
121 }
122 if (fPatchAttribs & PatchAttribs::kExplicitCurveType) {
123 // A conic curve is written out with p3=[w,Infinity], but GPUs that don't support
124 // infinity can't detect this. On these platforms we write out an extra float with each
125 // patch that explicitly tells the shader what type of curve it is.
126 fAttribs.emplace_back("curveTypeAttr", kFloat_GrVertexAttribType, SkSLType::kFloat);
127 }
128
129 this->setInstanceAttributesWithImplicitOffsets(fAttribs.data(), fAttribs.size());
130 SkASSERT(this->instanceStride() == sizeof(SkPoint) * 4 + PatchAttribsStride(fPatchAttribs));
131 if (!shaderCaps.fVertexIDSupport) {
132 constexpr static Attribute kVertexAttrib("edgeID", kFloat_GrVertexAttribType,
134 this->setVertexAttributesWithImplicitOffsets(&kVertexAttrib, 1);
135 }
136 SkASSERT(fAttribs.size() <= kMaxAttribCount);
137}
@ kFloat2_GrVertexAttribType
Definition: GrTypesPriv.h:314
@ kUByte4_norm_GrVertexAttribType
Definition: GrTypesPriv.h:334
@ kFloat_GrVertexAttribType
Definition: GrTypesPriv.h:313
@ kFloat4_GrVertexAttribType
Definition: GrTypesPriv.h:316
#define SkASSERT(cond)
Definition: SkAssert.h:116
void setInstanceAttributesWithImplicitOffsets(const Attribute *attrs, int attrCount)
size_t instanceStride() const
void setVertexAttributesWithImplicitOffsets(const Attribute *attrs, int attrCount)
@ kTessellate_GrStrokeTessellationShader_ClassID
Definition: GrProcessor.h:87
const SkStrokeRec & stroke() const
const SkPMColor4f & color() const
const SkMatrix & viewMatrix() const
GrTessellationShader(ClassID classID, GrPrimitiveType primitiveType, const SkMatrix &viewMatrix, const SkPMColor4f &color)
constexpr size_t PatchAttribsStride(PatchAttribs attribs)
Definition: Tessellation.h:103
bool fVertexIDSupport
Definition: GrShaderCaps.h:36
bool fInfinitySupport
Definition: SkSLUtil.h:103

Member Function Documentation

◆ attribs()

PatchAttribs GrStrokeTessellationShader::attribs ( ) const
inline

Definition at line 33 of file GrStrokeTessellationShader.h.

33{ return fPatchAttribs; }

◆ hasDynamicColor()

bool GrStrokeTessellationShader::hasDynamicColor ( ) const
inline

Definition at line 35 of file GrStrokeTessellationShader.h.

35{ return fPatchAttribs & PatchAttribs::kColor; }

◆ hasDynamicStroke()

bool GrStrokeTessellationShader::hasDynamicStroke ( ) const
inline

Definition at line 34 of file GrStrokeTessellationShader.h.

34{ return fPatchAttribs & PatchAttribs::kStrokeParams; }

◆ hasExplicitCurveType()

bool GrStrokeTessellationShader::hasExplicitCurveType ( ) const
inline

Definition at line 36 of file GrStrokeTessellationShader.h.

36{ return fPatchAttribs & PatchAttribs::kExplicitCurveType; }

◆ stroke()

const SkStrokeRec & GrStrokeTessellationShader::stroke ( ) const
inline

Definition at line 37 of file GrStrokeTessellationShader.h.

37{ return fStroke;}

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