Avoid assertion in MSAA rendering buffer about indexed draw with zero index count
Also add some GrMesh::validate() calls earlier to make future debugging easier. Previously this only asserted when the draws executed, now it asserts as soon as the draw is prepared in the op subclass.
Bug: skia:
Change-Id: Ibdd4488b9a9263f0ed337a2c8c6066bc36297001
Reviewed-on: https://skia-review.googlesource.com/16029
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index b2782df..49f8259 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -380,11 +380,9 @@
quads.indices = nullptr;
quads.nextIndex = nullptr;
}
-
// fill buffers
for (int i = 0; i < fPaths.count(); i++) {
const PathInfo& pathInfo = fPaths[i];
-
if (!this->createGeom(lines,
quads,
pathInfo.fPath,
@@ -423,7 +421,12 @@
lineMeshes.fVertexCount = lineVertexOffset;
lineMeshes.fBaseVertex = firstLineVertex;
- target->draw(lineGP.get(), this->pipeline(), lineMeshes);
+ // 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
+ // that case.
+ if (!fIsIndexed || lineIndexOffset) {
+ target->draw(lineGP.get(), this->pipeline(), lineMeshes);
+ }
}
if (quadVertexOffset) {