aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrMSAAPathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-05-26 15:17:19 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-30 16:02:36 +0000
commit114a3c0b2b26c84b9d0907a99fd8ab7938631246 (patch)
treea243fad112a79f3375ae98f0c916db63d9cdc9c0 /src/gpu/ops/GrMSAAPathRenderer.cpp
parent8cc933104b0e965c4226c91701cee7586587409f (diff)
Fix glDrawRangeElements
Adds explicit min/max index value fields to GrMesh. This eliminates the previous assumption that the index values were within the range [0..vertexCount-1]. In the pattern case we still maintain this assumption. Updates GrMesh to hide its fields and handle its new complexity using a "helper" interface instead. Adds a unit test for GrMesh. Bug: skia: Change-Id: Ia23de72d510f8827cee56072b727fb70a6e46b8d Reviewed-on: https://skia-review.googlesource.com/17964 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/ops/GrMSAAPathRenderer.cpp')
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index c3a5440fc3..36faf2f2c9 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -411,10 +411,13 @@ private:
SkASSERT(lineVertexStride == lineGP->getVertexStride());
GrMesh lineMeshes(primitiveType);
- if (fIsIndexed) {
- lineMeshes.setIndexed(lineIndexBuffer, lineIndexOffset, firstLineIndex);
+ if (!fIsIndexed) {
+ lineMeshes.setNonIndexed(lineVertexOffset);
+ } else {
+ lineMeshes.setIndexed(lineIndexBuffer, lineIndexOffset, firstLineIndex,
+ 0, lineVertexOffset - 1);
}
- lineMeshes.setVertices(lineVertexBuffer, lineVertexOffset, firstLineVertex);
+ lineMeshes.setVertexData(lineVertexBuffer, firstLineVertex);
// We can get line vertices from path moveTos with no actual segments and thus no index
// count. We assert that indexed draws contain a positive index count, so bail here in
@@ -435,16 +438,19 @@ private:
&firstQuadVertex);
memcpy(quadVertices, quads.vertices, quadVertexStride * quadVertexOffset);
GrMesh quadMeshes(kTriangles_GrPrimitiveType);
- if (fIsIndexed) {
+ if (!fIsIndexed) {
+ quadMeshes.setNonIndexed(quadVertexOffset);
+ } else {
const GrBuffer* quadIndexBuffer;
int firstQuadIndex;
uint16_t* quadIndices = (uint16_t*) target->makeIndexSpace(quadIndexOffset,
&quadIndexBuffer,
&firstQuadIndex);
memcpy(quadIndices, quads.indices, sizeof(uint16_t) * quadIndexOffset);
- quadMeshes.setIndexed(quadIndexBuffer, quadIndexOffset, firstQuadIndex);
+ quadMeshes.setIndexed(quadIndexBuffer, quadIndexOffset, firstQuadIndex,
+ 0, quadVertexOffset - 1);
}
- quadMeshes.setVertices(quadVertexBuffer, quadVertexOffset, firstQuadVertex);
+ quadMeshes.setVertexData(quadVertexBuffer, firstQuadVertex);
target->draw(quadGP.get(), this->pipeline(), quadMeshes);
}
}