Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::graphite::TessellateCurvesRenderStep Class Referencefinal

#include <TessellateCurvesRenderStep.h>

Inheritance diagram for skgpu::graphite::TessellateCurvesRenderStep:
skgpu::graphite::RenderStep

Public Member Functions

 TessellateCurvesRenderStep (bool evenOdd, bool infinitySupport, StaticBufferManager *bufferManager)
 
 ~TessellateCurvesRenderStep () override
 
std::string vertexSkSL () const override
 
void writeVertices (DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
 
void writeUniformsAndTextures (const DrawParams &, PipelineDataGatherer *) const override
 
- Public Member Functions inherited from skgpu::graphite::RenderStep
virtual ~RenderStep ()=default
 
virtual std::string texturesAndSamplersSkSL (const ResourceBindingRequirements &, int *nextBindingIndex) const
 
virtual const char * fragmentCoverageSkSL () const
 
virtual const char * fragmentColorSkSL () const
 
uint32_t uniqueID () const
 
const char * name () const
 
bool requiresMSAA () const
 
bool performsShading () const
 
bool hasTextures () const
 
bool emitsPrimitiveColor () const
 
bool outsetBoundsForAA () const
 
Coverage coverage () const
 
PrimitiveType primitiveType () const
 
size_t vertexStride () const
 
size_t instanceStride () const
 
size_t numUniforms () const
 
size_t numVertexAttributes () const
 
size_t numInstanceAttributes () const
 
SkSpan< const Uniformuniforms () const
 
SkSpan< const AttributevertexAttributes () const
 
SkSpan< const AttributeinstanceAttributes () const
 
SkSpan< const Varyingvaryings () const
 
const DepthStencilSettingsdepthStencilSettings () const
 
SkEnumBitMask< DepthStencilFlagsdepthStencilFlags () const
 

Additional Inherited Members

- Static Public Member Functions inherited from skgpu::graphite::RenderStep
static const char * ssboIndicesAttribute ()
 
static const char * ssboIndicesVarying ()
 
- Protected Types inherited from skgpu::graphite::RenderStep
enum class  Flags : unsigned {
  kNone = 0b0000000 , kRequiresMSAA = 0b0000001 , kPerformsShading = 0b0000010 , kHasTextures = 0b0000100 ,
  kEmitsCoverage = 0b0001000 , kLCDCoverage = 0b0010000 , kEmitsPrimitiveColor = 0b0100000 , kOutsetBoundsForAA = 0b1000000
}
 
- Protected Member Functions inherited from skgpu::graphite::RenderStep
 RenderStep (std::string_view className, std::string_view variantName, SkEnumBitMask< Flags > flags, std::initializer_list< Uniform > uniforms, PrimitiveType primitiveType, DepthStencilSettings depthStencilSettings, SkSpan< const Attribute > vertexAttrs, SkSpan< const Attribute > instanceAttrs, SkSpan< const Varying > varyings={})
 

Detailed Description

Definition at line 18 of file TessellateCurvesRenderStep.h.

Constructor & Destructor Documentation

◆ TessellateCurvesRenderStep()

skgpu::graphite::TessellateCurvesRenderStep::TessellateCurvesRenderStep ( bool  evenOdd,
bool  infinitySupport,
StaticBufferManager bufferManager 
)

Definition at line 63 of file TessellateCurvesRenderStep.cpp.

66 : RenderStep("TessellateCurvesRenderStep",
67 evenOdd ? "even-odd" : "winding",
69 /*uniforms=*/{{"localToDevice", SkSLType::kFloat4x4}},
72 /*vertexAttrs=*/ {{"resolveLevel_and_idx",
74 /*instanceAttrs=*/kAttributes[infinitySupport])
75 , fInfinitySupport(infinitySupport) {
76 SkASSERT(this->instanceStride() ==
77 PatchStride(infinitySupport ? kAttribs : kAttribsWithCurveType));
78
79 // Initialize the static buffers we'll use when recording draw calls.
80 // NOTE: Each instance of this RenderStep gets its own copy of the data. If this ends up causing
81 // problems, we can modify StaticBufferManager to de-duplicate requests.
82 const size_t vertexSize = FixedCountCurves::VertexBufferSize();
83 auto vertexData = bufferManager->getVertexWriter(vertexSize, &fVertexBuffer);
84 if (vertexData) {
85 FixedCountCurves::WriteVertexBuffer(std::move(vertexData), vertexSize);
86 } // otherwise static buffer creation failed, so do nothing; Context initialization will fail.
87
88 const size_t indexSize = FixedCountCurves::IndexBufferSize();
89 auto indexData = bufferManager->getIndexWriter(indexSize, &fIndexBuffer);
90 if (indexData) {
91 FixedCountCurves::WriteIndexBuffer(std::move(indexData), indexSize);
92 } // ""
93}
#define SkASSERT(cond)
Definition SkAssert.h:116
size_t instanceStride() const
Definition Renderer.h:128
RenderStep(std::string_view className, std::string_view variantName, SkEnumBitMask< Flags > flags, std::initializer_list< Uniform > uniforms, PrimitiveType primitiveType, DepthStencilSettings depthStencilSettings, SkSpan< const Attribute > vertexAttrs, SkSpan< const Attribute > instanceAttrs, SkSpan< const Varying > varyings={})
Definition Renderer.cpp:19
static void WriteIndexBuffer(VertexWriter, size_t bufferSize)
static constexpr size_t VertexBufferSize()
static constexpr size_t IndexBufferSize()
static void WriteVertexBuffer(VertexWriter, size_t bufferSize)
constexpr DepthStencilSettings kWindingStencilPass
constexpr DepthStencilSettings kEvenOddStencilPass
constexpr size_t PatchStride(PatchAttribs attribs)

◆ ~TessellateCurvesRenderStep()

skgpu::graphite::TessellateCurvesRenderStep::~TessellateCurvesRenderStep ( )
override

Definition at line 95 of file TessellateCurvesRenderStep.cpp.

95{}

Member Function Documentation

◆ vertexSkSL()

std::string skgpu::graphite::TessellateCurvesRenderStep::vertexSkSL ( ) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 97 of file TessellateCurvesRenderStep.cpp.

97 {
99 R"(
100 // TODO: Approximate perspective scaling to match how PatchWriter is configured (or
101 // provide explicit tessellation level in instance data instead of replicating
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1

◆ writeUniformsAndTextures()

void skgpu::graphite::TessellateCurvesRenderStep::writeUniformsAndTextures ( const DrawParams params,
PipelineDataGatherer gatherer 
) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 142 of file TessellateCurvesRenderStep.cpp.

142 : SkPathPriv::Iterate(path)) {
143 switch (verb) {
144 case SkPathVerb::kQuad: writer.writeQuadratic(pts); break;
145 case SkPathVerb::kConic: writer.writeConic(pts, *w); break;
146 case SkPathVerb::kCubic: writer.writeCubic(pts); break;
147 default: break;
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
SkScalar w

◆ writeVertices()

void skgpu::graphite::TessellateCurvesRenderStep::writeVertices ( DrawWriter dw,
const DrawParams params,
skvx::ushort2  ssboIndices 
) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 103 of file TessellateCurvesRenderStep.cpp.

110 : "curveType");
111}
112
114 const DrawParams& params,
115 skvx::ushort2 ssboIndices) const {
116 SkPath path = params.geometry().shape().asPath(); // TODO: Iterate the Shape directly
117
118 int patchReserveCount = FixedCountCurves::PreallocCount(path.countVerbs());
119 Writer writer{fInfinitySupport ? kAttribs : kAttribsWithCurveType,
120 *dw,
121 fVertexBuffer,
122 fIndexBuffer,
123 patchReserveCount};
124 writer.updatePaintDepthAttrib(params.order().depthAsFloat());
125 writer.updateSsboIndexAttrib(ssboIndices);
126
127 // The vector xform approximates how the control points are transformed by the shader to
128 // more accurately compute how many *parametric* segments are needed.
129 // TODO: This doesn't account for perspective division yet, which will require updating the
130 // approximate transform based on each verb's control points' bounding box.
131 SkASSERT(params.transform().type() < Transform::Type::kPerspective);
132 writer.setShaderTransform(wangs_formula::VectorXform{params.transform().matrix()},
133 params.transform().maxScaleFactor());
134
135 // TODO: For filled curves, the path verb loop is simple enough that it's not too big a deal
136 // to copy the logic from PathCurveTessellator::write_patches. It may be required if we end
137 // up switching to a shape iterator in graphite vs. a path iterator in ganesh, or if
138 // graphite does not control point transformation on the CPU. On the other hand, if we
139 // provide a templated WritePatches function, the iterator could also be a template arg in
140 // addition to PatchWriter's traits. Whatever pattern we choose will be based more on what's
void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
static constexpr int PreallocCount(int totalCombinedPathVerbCnt)
const EmbeddedViewParams * params
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

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