diff options
author | Brian Salomon <bsalomon@google.com> | 2017-05-09 09:57:19 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-09 17:41:28 +0000 |
commit | 2a55c8ef495b5fd501a3dee7c199c9064ab7e6bc (patch) | |
tree | 12a21197f2de44d42a7d8fa0def89161412233e3 /src | |
parent | 5c77975e4c00e18e644c72b56f369858acd11b15 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrGpuCommandBuffer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrMSAAPathRenderer.cpp | 9 | ||||
-rw-r--r-- | src/gpu/ops/GrMeshDrawOp.cpp | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/gpu/GrGpuCommandBuffer.cpp b/src/gpu/GrGpuCommandBuffer.cpp index b51d3ea22a..a57a13fda6 100644 --- a/src/gpu/GrGpuCommandBuffer.cpp +++ b/src/gpu/GrGpuCommandBuffer.cpp @@ -10,6 +10,7 @@ #include "GrCaps.h" #include "GrFixedClip.h" #include "GrGpu.h" +#include "GrMesh.h" #include "GrPrimitiveProcessor.h" #include "GrRenderTarget.h" #include "SkRect.h" @@ -39,6 +40,7 @@ bool GrGpuCommandBuffer::draw(const GrPipeline& pipeline, const GrMesh* mesh, int meshCount, const SkRect& bounds) { + SkDEBUGCODE(mesh->validate()); if (pipeline.isBad() || primProc.isBad()) { return false; } diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index b2782dff96..49f82596f5 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -380,11 +380,9 @@ private: 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 @@ private: 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) { diff --git a/src/gpu/ops/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp index ee7c0a58dc..c4521503e9 100644 --- a/src/gpu/ops/GrMeshDrawOp.cpp +++ b/src/gpu/ops/GrMeshDrawOp.cpp @@ -96,6 +96,7 @@ void GrMeshDrawOp::onExecute(GrOpFlushState* state) { void GrMeshDrawOp::Target::draw(const GrGeometryProcessor* gp, const GrPipeline* pipeline, const GrMesh& mesh) { + SkDEBUGCODE(mesh.validate()); GrMeshDrawOp* op = this->meshDrawOp(); op->fMeshes.push_back(mesh); if (!op->fQueuedDraws.empty()) { |