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

#include <GrTessellationShader.h>

Inheritance diagram for GrTessellationShader:
GrGeometryProcessor GrProcessor GrPathTessellationShader GrStrokeTessellationShader

Classes

struct  ProgramArgs
 

Public Member Functions

 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
 

Static Public Member Functions

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)
 

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 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 19 of file GrTessellationShader.h.

Constructor & Destructor Documentation

◆ GrTessellationShader()

GrTessellationShader::GrTessellationShader ( ClassID  classID,
GrPrimitiveType  primitiveType,
const SkMatrix viewMatrix,
const SkPMColor4f color 
)
inline

Definition at line 21 of file GrTessellationShader.h.

25 , fPrimitiveType(primitiveType)
26 , fViewMatrix(viewMatrix)
27 , fColor(color) {
28 }
ClassID classID() const
Definition: GrProcessor.h:129
GrPrimitiveType primitiveType() const
const SkPMColor4f & color() const
const SkMatrix & viewMatrix() const

Member Function Documentation

◆ color()

const SkPMColor4f & GrTessellationShader::color ( ) const
inline

Definition at line 32 of file GrTessellationShader.h.

32{ return fColor;}

◆ MakePipeline()

const GrPipeline * GrTessellationShader::MakePipeline ( const ProgramArgs args,
GrAAType  aaType,
GrAppliedClip &&  appliedClip,
GrProcessorSet &&  processors 
)
static

Definition at line 12 of file GrTessellationShader.cpp.

15 {
16 GrPipeline::InitArgs pipelineArgs;
17
18 pipelineArgs.fCaps = args.fCaps;
19 pipelineArgs.fDstProxyView = *args.fDstProxyView;
20 pipelineArgs.fWriteSwizzle = args.fWriteView.swizzle();
21
22 return args.fArena->make<GrPipeline>(pipelineArgs,
23 std::move(processors),
24 std::move(appliedClip));
25}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
skgpu::Swizzle fWriteSwizzle
Definition: GrPipeline.h:66
const GrCaps * fCaps
Definition: GrPipeline.h:64
GrDstProxyView fDstProxyView
Definition: GrPipeline.h:65

◆ MakeProgram()

static GrProgramInfo * GrTessellationShader::MakeProgram ( const ProgramArgs args,
const GrTessellationShader shader,
const GrPipeline pipeline,
const GrUserStencilSettings stencil 
)
inlinestatic

Definition at line 47 of file GrTessellationShader.h.

50 {
51 return args.fArena->make<GrProgramInfo>(*args.fCaps, args.fWriteView, args.fUsesMSAASurface,
52 pipeline, stencil, shader, shader->fPrimitiveType,
53 args.fXferBarrierFlags, args.fColorLoadOp);
54 }

◆ primitiveType()

GrPrimitiveType GrTessellationShader::primitiveType ( ) const
inline

Definition at line 30 of file GrTessellationShader.h.

30{ return fPrimitiveType; }

◆ viewMatrix()

const SkMatrix & GrTessellationShader::viewMatrix ( ) const
inline

Definition at line 31 of file GrTessellationShader.h.

31{ return fViewMatrix; }

◆ WangsFormulaSkSL()

const char * GrTessellationShader::WangsFormulaSkSL ( )
static

Definition at line 27 of file GrTessellationShader.cpp.

27 {
28 static_assert(skgpu::wangs_formula::length_term<3>(1) == 0.75);
29 static_assert(skgpu::wangs_formula::length_term_p2<3>(1) == 0.5625);
30
31 return
32// Returns the length squared of the largest forward difference from Wang's cubic formula.
33"float wangs_formula_max_fdiff_p2(float2 p0, float2 p1, float2 p2, float2 p3,"
34 "float2x2 matrix) {"
35 "float2 d0 = matrix * (fma(float2(-2), p1, p2) + p0);"
36 "float2 d1 = matrix * (fma(float2(-2), p2, p3) + p1);"
37 "return max(dot(d0,d0), dot(d1,d1));"
38"}"
39"float wangs_formula_cubic(float _precision_, float2 p0, float2 p1, float2 p2, float2 p3,"
40 "float2x2 matrix) {"
41 "float m = wangs_formula_max_fdiff_p2(p0, p1, p2, p3, matrix);"
42 "return max(ceil(sqrt(0.75 * _precision_ * sqrt(m))), 1.0);"
43"}"
44"float wangs_formula_cubic_log2(float _precision_, float2 p0, float2 p1, float2 p2, float2 p3,"
45 "float2x2 matrix) {"
46 "float m = wangs_formula_max_fdiff_p2(p0, p1, p2, p3, matrix);"
47 "return ceil(log2(max(0.5625 * _precision_ * _precision_ * m, 1.0)) * .25);"
48"}"
49"float wangs_formula_conic_p2(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
50 // Translate the bounding box center to the origin.
51 "float2 C = (min(min(p0, p1), p2) + max(max(p0, p1), p2)) * 0.5;"
52 "p0 -= C;"
53 "p1 -= C;"
54 "p2 -= C;"
55
56 // Compute max length.
57 "float m = sqrt(max(max(dot(p0,p0), dot(p1,p1)), dot(p2,p2)));"
58
59 // Compute forward differences.
60 "float2 dp = fma(float2(-2.0 * w), p1, p0) + p2;"
61 "float dw = abs(fma(-2.0, w, 2.0));"
62
63 // Compute numerator and denominator for parametric step size of linearization. Here, the
64 // epsilon referenced from the cited paper is 1/precision.
65 "float rp_minus_1 = max(0.0, fma(m, _precision_, -1.0));"
66 "float numer = length(dp) * _precision_ + rp_minus_1 * dw;"
67 "float denom = 4 * min(w, 1.0);"
68
69 "return numer/denom;"
70"}"
71"float wangs_formula_conic(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
72 "float n2 = wangs_formula_conic_p2(_precision_, p0, p1, p2, w);"
73 "return max(ceil(sqrt(n2)), 1.0);"
74"}"
75"float wangs_formula_conic_log2(float _precision_, float2 p0, float2 p1, float2 p2, float w) {"
76 "float n2 = wangs_formula_conic_p2(_precision_, p0, p1, p2, w);"
77 "return ceil(log2(max(n2, 1.0)) * .5);"
78"}"
79;
80}

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