diff options
Diffstat (limited to 'tests/GrPipelineDynamicStateTest.cpp')
-rw-r--r-- | tests/GrPipelineDynamicStateTest.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp index 0f786e7c23..87db111a1a 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -58,9 +58,9 @@ struct Vertex { class GrPipelineDynamicStateTestProcessor : public GrGeometryProcessor { public: GrPipelineDynamicStateTestProcessor() - : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) - , fVertex(this->addVertexAttrib("vertex", kHalf2_GrVertexAttribType)) - , fColor(this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType)) {} + : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) { + this->setVertexAttributeCnt(2); + } const char* name() const override { return "GrPipelineDynamicStateTest Processor"; } @@ -68,13 +68,19 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const final; -protected: - const Attribute& fVertex; - const Attribute& fColor; +private: + const Attribute& onVertexAttribute(int i) const override { + return IthAttribute(i, kVertex, kColor); + } + + static constexpr Attribute kVertex = {"vertex", kHalf2_GrVertexAttribType}; + static constexpr Attribute kColor = {"color", kUByte4_norm_GrVertexAttribType}; friend class GLSLPipelineDynamicStateTestProcessor; typedef GrGeometryProcessor INHERITED; }; +constexpr GrPrimitiveProcessor::Attribute GrPipelineDynamicStateTestProcessor::kVertex; +constexpr GrPrimitiveProcessor::Attribute GrPipelineDynamicStateTestProcessor::kColor; class GLSLPipelineDynamicStateTestProcessor : public GrGLSLGeometryProcessor { void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor&, @@ -86,10 +92,10 @@ class GLSLPipelineDynamicStateTestProcessor : public GrGLSLGeometryProcessor { GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; varyingHandler->emitAttributes(mp); - varyingHandler->addPassThroughAttribute(&mp.fColor, args.fOutputColor); + varyingHandler->addPassThroughAttribute(mp.kColor, args.fOutputColor); GrGLSLVertexBuilder* v = args.fVertBuilder; - v->codeAppendf("float2 vertex = %s;", mp.fVertex.name()); + v->codeAppendf("float2 vertex = %s;", mp.kVertex.name()); gpArgs->fPositionVar.set(kFloat2_GrSLType, "vertex"); GrGLSLFPFragmentBuilder* f = args.fFragBuilder; |