diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-06-18 09:51:36 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-18 16:14:28 +0000 |
commit | 4da70190aadd8a346ea967a3c435d20a80a5cccd (patch) | |
tree | f986a7da77639a58363a0e840833fd1c090744b7 /src/gpu/ccpr/GrCCPathProcessor.cpp | |
parent | ddc0c6006c44bd31ef0adc9eb06e68b17218198f (diff) |
ccpr: Implement path mask caching
Implement caching as follows:
1) Instead of deleting the mainline ccpr atlas when finished, stash it
away from flush to flush.
2) On subsequent flushes, check the stashed atlas to see if we can
reuse any of its cachable paths. Copy reusable paths into 8-bit
literal coverage atlases and store them in the resource cache.
3) Recycle the stashed atlas texture for the remaining paths in the
flush.
Bug: skia:
Change-Id: I9b20fbea708646df1df3a5f9c044e2299706b989
Reviewed-on: https://skia-review.googlesource.com/134703
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ccpr/GrCCPathProcessor.cpp')
-rw-r--r-- | src/gpu/ccpr/GrCCPathProcessor.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp index 39d5ef2819..b8ebb44059 100644 --- a/src/gpu/ccpr/GrCCPathProcessor.cpp +++ b/src/gpu/ccpr/GrCCPathProcessor.cpp @@ -10,6 +10,7 @@ #include "GrGpuCommandBuffer.h" #include "GrOnFlushResourceProvider.h" #include "GrTexture.h" +#include "ccpr/GrCCPerFlushResources.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLProgramBuilder.h" @@ -131,9 +132,8 @@ GrGLSLPrimitiveProcessor* GrCCPathProcessor::createGLSLInstance(const GrShaderCa } void GrCCPathProcessor::drawPaths(GrOpFlushState* flushState, const GrPipeline& pipeline, - const GrBuffer* indexBuffer, const GrBuffer* vertexBuffer, - GrBuffer* instanceBuffer, int baseInstance, int endInstance, - const SkRect& bounds) const { + const GrCCPerFlushResources& resources, int baseInstance, + int endInstance, const SkRect& bounds) const { const GrCaps& caps = flushState->caps(); GrPrimitiveType primitiveType = caps.usePrimitiveRestart() ? GrPrimitiveType::kTriangleStrip @@ -144,9 +144,10 @@ void GrCCPathProcessor::drawPaths(GrOpFlushState* flushState, const GrPipeline& GrMesh mesh(primitiveType); auto enablePrimitiveRestart = GrPrimitiveRestart(flushState->caps().usePrimitiveRestart()); - mesh.setIndexedInstanced(indexBuffer, numIndicesPerInstance, instanceBuffer, - endInstance - baseInstance, baseInstance, enablePrimitiveRestart); - mesh.setVertexData(vertexBuffer); + mesh.setIndexedInstanced(resources.indexBuffer(), numIndicesPerInstance, + resources.instanceBuffer(), endInstance - baseInstance, baseInstance, + enablePrimitiveRestart); + mesh.setVertexData(resources.vertexBuffer()); flushState->rtCommandBuffer()->draw(pipeline, *this, &mesh, nullptr, 1, bounds); } |