28using CurveWriter =
PatchWriter<VertexChunkPatchAllocator,
35void write_curve_patches(CurveWriter&& patchWriter,
37 const PathTessellator::PathDrawList& pathDrawList) {
39 for (
auto [pathMatrix,
path,
color] : pathDrawList) {
42 patchWriter.updateColorAttrib(
color);
47 auto [p0, p1] =
m.map2Points(pts);
48 auto p2 =
m.map1Point(pts+2);
50 patchWriter.writeQuadratic(p0, p1, p2);
55 auto [p0, p1] =
m.map2Points(pts);
56 auto p2 =
m.map1Point(pts+2);
58 patchWriter.writeConic(p0, p1, p2, *
w);
63 auto [p0, p1] =
m.map2Points(pts);
64 auto [p2, p3] =
m.map2Points(pts+2);
66 patchWriter.writeCubic(p0, p1, p2, p3);
76using WedgeWriter =
PatchWriter<VertexChunkPatchAllocator,
82void write_wedge_patches(WedgeWriter&& patchWriter,
84 const PathTessellator::PathDrawList& pathDrawList) {
86 for (
auto [pathMatrix,
path,
color] : pathDrawList) {
89 patchWriter.updateColorAttrib(
color);
92 while (
parser.parseNextContour()) {
93 patchWriter.updateFanPointAttrib(
m.mapPoint(
parser.currentMidpoint()));
96 for (
auto [verb, pts,
w] :
parser.currentContour()) {
99 startPoint = lastPoint = pts[0];
106 patchWriter.writeLine(
m.map2Points(pts));
112 auto [p0, p1] =
m.map2Points(pts);
113 auto p2 =
m.map1Point(pts+2);
115 patchWriter.writeQuadratic(p0, p1, p2);
121 auto [p0, p1] =
m.map2Points(pts);
122 auto p2 =
m.map1Point(pts+2);
124 patchWriter.writeConic(p0, p1, p2, *
w);
130 auto [p0, p1] =
m.map2Points(pts);
131 auto [p2, p3] =
m.map2Points(pts+2);
133 patchWriter.writeCubic(p0, p1, p2, p3);
143 if (lastPoint != startPoint) {
144 SkPoint pts[2] = {lastPoint, startPoint};
145 patchWriter.writeLine(
m.map2Points(pts));
161 int totalCombinedPathVerbCnt) {
162#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
164 (extraTriangles ? extraTriangles->
count() : 0);
171 if (patchPreallocCount) {
175#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
178 if (extraTriangles) {
180 for (
const auto* tri = extraTriangles->
head(); tri; tri = tri->
fNext) {
185 if (
any((p0 == p1) & (p1 == p2))) {
193 writer.writeTriangle(p0, p1, p2);
199 write_curve_patches(std::move(writer), shaderMatrix, pathDrawList);
209 gFixedCountCurveVertexBufferKey,
216 gFixedCountCurveIndexBufferKey,
235 flushState->
bindBuffers(
nullptr, chunk.fBuffer, vertexBufferIfNeeded);
247 int totalCombinedPathVerbCnt) {
251 write_wedge_patches(std::move(writer), shaderMatrix, pathDrawList);
261 gFixedCountWedgesVertexBufferKey,
268 gFixedCountWedgesIndexBufferKey,
#define SKGPU_DEFINE_STATIC_UNIQUE_KEY(name)
@ kClose
SkPath::RawIter returns 0 points.
@ 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.
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
void drawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex)
void bindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart primitiveRestart=GrPrimitiveRestart::kNo)
void drawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex)
sk_sp< const GrGpuBuffer > findOrMakeStaticBuffer(GrGpuBufferType intendedType, size_t size, const skgpu::UniqueKey &key, InitializeBufferFn)
const Node * head() const
void drawHullInstances(GrOpFlushState *, sk_sp< const GrGpuBuffer > vertexBufferIfNeeded) const
void prepareWithTriangles(GrMeshDrawTarget *target, const SkMatrix &shaderMatrix, GrInnerFanTriangulator::BreadcrumbTriangleList *extraTriangles, const PathDrawList &pathDrawList, int totalCombinedPathVerbCnt)
void draw(GrOpFlushState *) const final
GrVertexChunkArray fVertexChunkArray
sk_sp< const GrGpuBuffer > fFixedIndexBuffer
sk_sp< const GrGpuBuffer > fFixedVertexBuffer
void prepare(GrMeshDrawTarget *target, const SkMatrix &shaderMatrix, const PathDrawList &pathDrawList, int totalCombinedPathVerbCnt) final
void draw(GrOpFlushState *) const final
static void WriteIndexBuffer(VertexWriter, size_t bufferSize)
static constexpr size_t VertexBufferSize()
static int VertexCount(const LinearTolerances &tolerances)
static constexpr int PreallocCount(int totalCombinedPathVerbCnt)
static constexpr size_t IndexBufferSize()
static void WriteVertexBuffer(VertexWriter, size_t bufferSize)
static constexpr size_t IndexBufferSize()
static int VertexCount(const LinearTolerances &tolerances)
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)
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
SKGPU_DECLARE_STATIC_UNIQUE_KEY(gUnitQuadBufferKey)
SIT bool any(const Vec< 1, T > &x)
static SKVX_ALWAYS_INLINE Vec Load(const void *ptr)