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 --- gm/beziereffects.cpp | 11 +++++++---- gm/convexpolyeffect.cpp | 5 ++--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gm') diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 26da791746..9f3bcd74ec 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -50,7 +50,7 @@ protected: this->setBounds(rect, HasAABloat::kYes, IsZeroArea::kNo); } - const GrPipeline* makePipeline(Target* target) { + Target::PipelineAndFixedDynamicState makePipeline(Target* target) { return target->makePipeline(0, std::move(fProcessorSet), target->detachAppliedClip()); } @@ -100,7 +100,8 @@ private: } SkRect rect = this->rect(); SkPointPriv::SetRectTriStrip(pts, rect, sizeof(SkPoint)); - helper.recordDraw(target, this->gp(), this->makePipeline(target)); + auto pipe = this->makePipeline(target); + helper.recordDraw(target, this->gp(), pipe.fPipeline, pipe.fFixedDynamicState); } static constexpr int kVertsPerCubic = 4; @@ -296,7 +297,8 @@ private: SkPoint3 pt3 = {verts[v].fPosition.x(), verts[v].fPosition.y(), 1.f}; fKLM.mapHomogeneousPoints((SkPoint3* ) verts[v].fKLM, &pt3, 1); } - helper.recordDraw(target, this->gp(), this->makePipeline(target)); + auto pipe = this->makePipeline(target); + helper.recordDraw(target, this->gp(), pipe.fPipeline, pipe.fFixedDynamicState); } SkMatrix fKLM; @@ -513,7 +515,8 @@ private: SkRect rect = this->rect(); SkPointPriv::SetRectTriStrip(&verts[0].fPosition, rect, sizeof(Vertex)); fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); - helper.recordDraw(target, this->gp(), this->makePipeline(target)); + auto pipe = this->makePipeline(target); + helper.recordDraw(target, this->gp(), pipe.fPipeline, pipe.fFixedDynamicState); } GrPathUtils::QuadUVMatrix fDevToUV; diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 496b6b173f..3c825dc78a 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -92,9 +92,8 @@ private: SkPointPriv::SetRectTriStrip(verts, fRect, sizeof(SkPoint)); - helper.recordDraw( - target, gp.get(), - target->makePipeline(0, std::move(fProcessors), target->detachAppliedClip())); + auto pipe = target->makePipeline(0, std::move(fProcessors), target->detachAppliedClip()); + helper.recordDraw(target, gp.get(), pipe.fPipeline, pipe.fFixedDynamicState); } bool onCombineIfPossible(GrOp* op, const GrCaps& caps) override { return false; } -- cgit v1.2.3