From 493489054f85d1b7725412ad7a3cdc70c7ec5466 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 26 Jun 2018 09:12:38 -0400 Subject: Refactor GrPipeline dynamic state. Remove scissor rect from GrPipeline. Draws can specify "fixed dynamic state" which doesn't use the dynamism at all or can specify dynamic state arrays with an entry per GrMesh. When we state other than scissor rects this will allow the caller to use a mix of truly dynamic and fixed dynamic state. So a caller that only has dynamic scissor rects doesn't need to store its remaining unvarying state in an array. Change-Id: I8fcc07eb600c72a26cc712b185755c2116021a8a Reviewed-on: https://skia-review.googlesource.com/137223 Reviewed-by: Chris Dalton Commit-Queue: Brian Salomon --- src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp') diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp index b6b70779ff..1876d6c531 100644 --- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp @@ -206,9 +206,9 @@ public: } private: - void draw(GrMeshDrawOp::Target* target, const GrGeometryProcessor* gp, - const GrPipeline* pipeline, int vertexCount, size_t vertexStride, void* vertices, - int indexCount, uint16_t* indices) const { + void draw(Target* target, const GrGeometryProcessor* gp, const GrPipeline* pipeline, + const GrPipeline::FixedDynamicState* fixedDynamicState, int vertexCount, + size_t vertexStride, void* vertices, int indexCount, uint16_t* indices) const { if (vertexCount == 0 || indexCount == 0) { return; } @@ -234,12 +234,11 @@ private: mesh.setIndexed(indexBuffer, indexCount, firstIndex, 0, vertexCount - 1, GrPrimitiveRestart::kNo); mesh.setVertexData(vertexBuffer, firstVertex); - target->draw(gp, pipeline, mesh); + target->draw(gp, pipeline, fixedDynamicState, mesh); } void onPrepareDraws(Target* target) override { - const GrPipeline* pipeline = fHelper.makePipeline(target); - + auto pipe = fHelper.makePipeline(target); // Setup GrGeometryProcessor sk_sp gp(create_lines_only_gp(fHelper.compatibleWithAlphaAsCoverage(), this->viewMatrix(), @@ -275,8 +274,8 @@ private: if (vertexCount + currentVertices > static_cast(UINT16_MAX)) { // if we added the current instance, we would overflow the indices we can store in a // uint16_t. Draw what we've got so far and reset. - this->draw(target, gp.get(), pipeline, vertexCount, vertexStride, vertices, - indexCount, indices); + this->draw(target, gp.get(), pipe.fPipeline, pipe.fFixedDynamicState, vertexCount, + vertexStride, vertices, indexCount, indices); vertexCount = 0; indexCount = 0; } @@ -307,8 +306,8 @@ private: indexCount += currentIndices; } if (vertexCount <= SK_MaxS32 && indexCount <= SK_MaxS32) { - this->draw(target, gp.get(), pipeline, vertexCount, vertexStride, vertices, indexCount, - indices); + this->draw(target, gp.get(), pipe.fPipeline, pipe.fFixedDynamicState, vertexCount, + vertexStride, vertices, indexCount, indices); } sk_free(vertices); sk_free(indices); -- cgit v1.2.3