diff options
author | 2017-12-04 11:45:51 -0700 | |
---|---|---|
committer | 2017-12-05 21:12:48 +0000 | |
commit | a3e9271ec41db6c3b6886e50053f37d345ab1d5c (patch) | |
tree | 97772078cf13d954ac4ba135fcd20feda6bb22e1 /src/gpu/ccpr/GrCCPRPathProcessor.cpp | |
parent | 60691a5127852631b03250f15fa6cda9a504befc (diff) |
CCPR: Eliminate texel buffers
Points cost 8 bytes and indices cost 4. If a point is accessed twice,
it's a wash whether we duplicate it or index. This change eliminates
texel buffers by duplicating points across instance arrays. This
reduces our dependence on extensions as well as getting rid of our
indirect memory access pattern in vertex shaders.
As a result of this change, memory usage by GPU buffers will only be a
fraction larger at worst, and slightly better at best.
Bug: skia:
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SKNX_NO_SIMD
Change-Id: I3c7f03772edd4f850d5fdd7b55552647335c1b52
Reviewed-on: https://skia-review.googlesource.com/79185
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/ccpr/GrCCPRPathProcessor.cpp')
-rw-r--r-- | src/gpu/ccpr/GrCCPRPathProcessor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp index ff3c60c134..612035af4a 100644 --- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp +++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp @@ -51,7 +51,9 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey); GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTextureProxy> atlas, SkPath::FillType fillType, const GrShaderCaps& shaderCaps) : INHERITED(kGrCCPRPathProcessor_ClassID) - , fFillType(fillType) { + , fFillType(fillType) + , fAtlasAccess(std::move(atlas), GrSamplerState::Filter::kNearest, + GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag) { this->addInstanceAttrib("devbounds", kFloat4_GrVertexAttribType); this->addInstanceAttrib("devbounds45", kFloat4_GrVertexAttribType); this->addInstanceAttrib("view_matrix", kFloat4_GrVertexAttribType); @@ -77,8 +79,6 @@ GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTexture this->addVertexAttrib("edge_norms", kFloat4_GrVertexAttribType); - fAtlasAccess.reset(std::move(atlas), GrSamplerState::Filter::kNearest, - GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag); fAtlasAccess.instantiate(rp); this->addTextureSampler(&fAtlasAccess); } |