Convert GrMesh to a struct
Converts GrMesh to a struct and changes the names/semantics of its
fields to be more inline with their GL counterparts. Also renames the
"instancing" feature to "pattern", to avoid ambiguity with hardware
instancing.
Bug: skia:
Change-Id: Ia0999d4f9c83b5dd31f81b9bf4f36ed9abd26286
Reviewed-on: https://skia-review.googlesource.com/15157
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 71f8bb0..4d44b13 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1097,8 +1097,13 @@
}
GrMesh mesh;
- mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex,
- firstIndex, fVertCount, fIndexCount);
+ mesh.fPrimitiveType = kTriangles_GrPrimitiveType;
+ mesh.fIndexBuffer.reset(indexBuffer);
+ mesh.fIndexCount = fIndexCount;
+ mesh.fBaseIndex = firstIndex;
+ mesh.fVertexBuffer.reset(vertexBuffer);
+ mesh.fVertexCount = fVertCount;
+ mesh.fBaseVertex = firstVertex;
target->draw(gp.get(), this->pipeline(), mesh);
}
@@ -1998,8 +2003,13 @@
}
GrMesh mesh;
- mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex,
- firstIndex, fVertCount, fIndexCount);
+ mesh.fPrimitiveType = kTriangles_GrPrimitiveType;
+ mesh.fIndexBuffer.reset(indexBuffer);
+ mesh.fIndexCount = fIndexCount;
+ mesh.fBaseIndex = firstIndex;
+ mesh.fVertexBuffer.reset(vertexBuffer);
+ mesh.fVertexCount = fVertCount;
+ mesh.fBaseVertex = firstVertex;
target->draw(gp.get(), this->pipeline(), mesh);
}
@@ -2055,11 +2065,11 @@
GR_DEFINE_STATIC_UNIQUE_KEY(gRRectOnlyIndexBufferKey);
switch (type) {
case kFill_RRectType:
- return resourceProvider->findOrCreateInstancedIndexBuffer(
+ return resourceProvider->findOrCreatePatternedIndexBuffer(
gStandardRRectIndices, kIndicesPerFillRRect, kNumRRectsInIndexBuffer,
kVertsPerStandardRRect, gRRectOnlyIndexBufferKey);
case kStroke_RRectType:
- return resourceProvider->findOrCreateInstancedIndexBuffer(
+ return resourceProvider->findOrCreatePatternedIndexBuffer(
gStandardRRectIndices, kIndicesPerStrokeRRect, kNumRRectsInIndexBuffer,
kVertsPerStandardRRect, gStrokeRRectOnlyIndexBufferKey);
default:
@@ -2185,7 +2195,7 @@
sk_sp<const GrBuffer> indexBuffer(ref_rrect_index_buffer(
fStroked ? kStroke_RRectType : kFill_RRectType, target->resourceProvider()));
- InstancedHelper helper;
+ PatternHelper helper;
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(
helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer.get(),
kVertsPerStandardRRect, indicesPerInstance, instanceCount));