32static constexpr PatchAttribs kAttribs = PatchAttribs::kFanPoint |
33 PatchAttribs::kPaintDepth |
34 PatchAttribs::kSsboIndex;
35static constexpr PatchAttribs kAttribsWithCurveType = kAttribs | PatchAttribs::kExplicitCurveType;
46static constexpr Attribute kBaseAttributes[] = {
53static constexpr Attribute kAttributesWithCurveType[] = {
72 Flags::kRequiresMSAA |
73 (depthStencilSettings.fDepthWriteEnabled ?
Flags::kPerformsShading
78 {{
"resolveLevel_and_idx",
80 kAttributes[infinitySupport])
81 , fInfinitySupport(infinitySupport) {
83 PatchStride(infinitySupport ? kAttribs : kAttribsWithCurveType));
89 auto vertexData = bufferManager->getVertexWriter(vertexSize, &fVertexBuffer);
95 auto indexData = bufferManager->getIndexWriter(indexSize, &fIndexBuffer);
107 if (resolveLevel_and_idx.x < 0) {
108 // A negative resolve level means this is the fan point.
109 localCoord = fanPointAttrib;
111 // TODO: Approximate perspective scaling to match how PatchWriter is configured
112 // (or provide explicit tessellation level in instance data instead of
114 float2x2 vectorXform = float2x2(localToDevice[0].xy, localToDevice[1].xy);
115 localCoord = tessellate_filled_curve(
116 vectorXform, resolveLevel_and_idx.x, resolveLevel_and_idx.y, p01, p23, %s);
118 float4 devPosition = localToDevice * float4(localCoord, 0.0, 1.0);
119 devPosition.z = depth;
120 stepLocalCoords = localCoord;
122 fInfinitySupport ? "curve_type_using_inf_support(p23)" :
"curveType");
131 Writer writer{fInfinitySupport ? kAttribs : kAttribsWithCurveType,
136 writer.updatePaintDepthAttrib(
params.order().depthAsFloat());
137 writer.updateSsboIndexAttrib(ssboIndices);
145 params.transform().maxScaleFactor());
152 while (
parser.parseNextContour()) {
153 writer.updateFanPointAttrib(
parser.currentMidpoint());
156 for (
auto [verb, pts,
w] :
parser.currentContour()) {
159 startPoint = lastPoint = pts[0];
164 writer.writeLine(pts[0], pts[1]);
168 writer.writeQuadratic(pts);
172 writer.writeConic(pts, *
w);
176 writer.writeCubic(pts);
185 if (lastPoint != startPoint) {
186 writer.writeLine(lastPoint, startPoint);
192 PipelineDataGatherer* gatherer)
const {
195 gatherer->write(
params.transform().matrix());
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
size_t instanceStride() const
SkSpan< const Uniform > uniforms() const
void writeVertices(DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
void writeUniformsAndTextures(const DrawParams &, PipelineDataGatherer *) const override
~TessellateWedgesRenderStep() override
TessellateWedgesRenderStep(std::string_view variantName, bool infinitySupport, DepthStencilSettings depthStencilSettings, StaticBufferManager *bufferManager)
std::string vertexSkSL() const override
static constexpr size_t IndexBufferSize()
static constexpr int PreallocCount(int totalCombinedPathVerbCnt)
static constexpr size_t VertexBufferSize()
static void WriteVertexBuffer(VertexWriter, size_t bufferSize)
static void WriteIndexBuffer(VertexWriter, size_t bufferSize)
const EmbeddedViewParams * params
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
constexpr size_t PatchStride(PatchAttribs attribs)