diff options
author | egdaniel <egdaniel@google.com> | 2016-03-17 11:35:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-17 11:35:45 -0700 |
commit | 0e1853c89615d14d0d03c87c7e0c604e5285cc54 (patch) | |
tree | e0ffc4b77a62d396b548f6e45fc8b335d3e6ecc1 /src/gpu/GrPathRendering.h | |
parent | 852f15da7ceb53cfb49b9f728baa6dbc53b27694 (diff) |
Update how we send draws to gpu backend to reduce state setting.
The main change here is that we pull primitive type off of the vertices, we set the gpu state on gpu once per pipeline/prim proc draw batch, and we create the ProgramDescriptor only for the Cache/ProgramBuilder.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1806983002
Review URL: https://codereview.chromium.org/1806983002
Diffstat (limited to 'src/gpu/GrPathRendering.h')
-rw-r--r-- | src/gpu/GrPathRendering.h | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h index a2e9c0295b..b2863b5b36 100644 --- a/src/gpu/GrPathRendering.h +++ b/src/gpu/GrPathRendering.h @@ -152,38 +152,35 @@ public: this->onStencilPath(args, path); } - struct DrawPathArgs : public GrGpu::DrawArgs { - DrawPathArgs(const GrPrimitiveProcessor* primProc, - const GrPipeline* pipeline, - const GrProgramDesc* desc, - const GrStencilSettings* stencil) - : DrawArgs(primProc, pipeline, desc) - , fStencil(stencil) { - } - - const GrStencilSettings* fStencil; - }; - - void drawPath(const DrawPathArgs& args, const GrPath* path) { + void drawPath(const GrPipeline& pipeline, + const GrPrimitiveProcessor& primProc, + const GrStencilSettings& stencil, + const GrPath* path) { fGpu->handleDirtyContext(); - if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*fGpu->caps())) { - fGpu->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); + if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps())) { + fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); } - this->onDrawPath(args, path); + this->onDrawPath(pipeline, primProc, stencil, path); } - void drawPaths(const DrawPathArgs& args, const GrPathRange* pathRange, const void* indices, - PathIndexType indexType, const float transformValues[], - PathTransformType transformType, int count) { + void drawPaths(const GrPipeline& pipeline, + const GrPrimitiveProcessor& primProc, + const GrStencilSettings& stencil, + const GrPathRange* pathRange, + const void* indices, + PathIndexType indexType, + const float transformValues[], + PathTransformType transformType, + int count) { fGpu->handleDirtyContext(); - if (GrXferBarrierType barrierType = args.fPipeline->xferBarrierType(*fGpu->caps())) { - fGpu->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); + if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps())) { + fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); } #ifdef SK_DEBUG pathRange->assertPathsLoaded(indices, indexType, count); #endif - this->onDrawPaths(args, pathRange, indices, indexType, transformValues, transformType, - count); + this->onDrawPaths(pipeline, primProc, stencil, pathRange, indices, indexType, + transformValues, transformType, count); } protected: @@ -191,9 +188,19 @@ protected: : fGpu(gpu) { } virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; - virtual void onDrawPath(const DrawPathArgs&, const GrPath*) = 0; - virtual void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void*, PathIndexType, - const float[], PathTransformType, int) = 0; + virtual void onDrawPath(const GrPipeline&, + const GrPrimitiveProcessor&, + const GrStencilSettings&, + const GrPath*) = 0; + virtual void onDrawPaths(const GrPipeline&, + const GrPrimitiveProcessor&, + const GrStencilSettings&, + const GrPathRange*, + const void* indices, + PathIndexType, + const float transformValues[], + PathTransformType, + int count) = 0; GrGpu* fGpu; private: |