diff options
author | Brian Salomon <bsalomon@google.com> | 2018-06-19 14:33:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-19 20:01:29 +0000 |
commit | 92be2f74db81f0ed480b55c58cbde39270f9b772 (patch) | |
tree | d2b7135f511a318f10c5c86f2537c07051c922bd /src/gpu/ccpr/GrCCPathProcessor.h | |
parent | f5ac906476cd26f2967a48340940e6af580fa71f (diff) |
Revert "Revert "Change how vertex/instance attributes are handled in geometry processors.""
This reverts commit 5045e501d2aec23e5f1e4b46346033ac3202c6b0.
TBR=csmartdalton@google.com
Change-Id: Ifbf5f1d8f8ef340fdc69653e931b6d68d4bf0854
Reviewed-on: https://skia-review.googlesource.com/135862
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ccpr/GrCCPathProcessor.h')
-rw-r--r-- | src/gpu/ccpr/GrCCPathProcessor.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h index 785dd2c919..54c1b7e2ed 100644 --- a/src/gpu/ccpr/GrCCPathProcessor.h +++ b/src/gpu/ccpr/GrCCPathProcessor.h @@ -77,16 +77,11 @@ public: const GrTexture* atlas() const { return fAtlasAccess.peekTexture(); } const SkMatrix& localMatrix() const { return fLocalMatrix; } const Attribute& getInstanceAttrib(InstanceAttribs attribID) const { - const Attribute& attrib = this->getAttrib((int)attribID); - SkASSERT(Attribute::InputRate::kPerInstance == attrib.inputRate()); - return attrib; - } - const Attribute& getEdgeNormsAttrib() const { - SkASSERT(1 + kNumInstanceAttribs == this->numAttribs()); - const Attribute& attrib = this->getAttrib(kNumInstanceAttribs); - SkASSERT(Attribute::InputRate::kPerVertex == attrib.inputRate()); - return attrib; + int idx = static_cast<int>(attribID); + SkASSERT(idx >= 0 && idx < static_cast<int>(SK_ARRAY_COUNT(kInstanceAttribs))); + return kInstanceAttribs[idx]; } + const Attribute& getEdgeNormsAttrib() const { return kEdgeNormsAttrib; } void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; @@ -95,8 +90,18 @@ public: int baseInstance, int endInstance, const SkRect& bounds) const; private: + const Attribute& onVertexAttribute(int i) const override { return kEdgeNormsAttrib; } + const Attribute& onInstanceAttribute(int i) const override { return kInstanceAttribs[i]; } + const TextureSampler fAtlasAccess; SkMatrix fLocalMatrix; + static constexpr Attribute kInstanceAttribs[kNumInstanceAttribs] = { + {"devbounds", kFloat4_GrVertexAttribType}, + {"devbounds45", kFloat4_GrVertexAttribType}, + {"dev_to_atlas_offset", kInt2_GrVertexAttribType}, + {"color", kUByte4_norm_GrVertexAttribType} + }; + static constexpr Attribute kEdgeNormsAttrib = {"edge_norms", kFloat4_GrVertexAttribType}; typedef GrGeometryProcessor INHERITED; }; |