aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr/GrCCPathProcessor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ccpr/GrCCPathProcessor.h')
-rw-r--r--src/gpu/ccpr/GrCCPathProcessor.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/gpu/ccpr/GrCCPathProcessor.h b/src/gpu/ccpr/GrCCPathProcessor.h
index 54c1b7e2ed..785dd2c919 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPathProcessor.h
@@ -77,11 +77,16 @@ public:
const GrTexture* atlas() const { return fAtlasAccess.peekTexture(); }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
const Attribute& getInstanceAttrib(InstanceAttribs attribID) const {
- int idx = static_cast<int>(attribID);
- SkASSERT(idx >= 0 && idx < static_cast<int>(SK_ARRAY_COUNT(kInstanceAttribs)));
- return kInstanceAttribs[idx];
+ 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;
}
- const Attribute& getEdgeNormsAttrib() const { return kEdgeNormsAttrib; }
void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
@@ -90,18 +95,8 @@ 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;
};