From 5045e501d2aec23e5f1e4b46346033ac3202c6b0 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 19 Jun 2018 01:40:57 +0000 Subject: Revert "Change how vertex/instance attributes are handled in geometry processors." This reverts commit 19c1233c447f625c2522e7ecd0a0adecc629bb2f. Reason for revert: want to make sure Google3 can roll Original change's description: > Change how vertex/instance attributes are handled in geometry processors. > > * No longer register vertex/instance attributes on base class, just counts > > * Separate instance and vertex attributes and remove InputRate and offset > > * Make attributes constexpr where possible > > Change-Id: I1f1d5e772fa177a96d2aeb805aab7b69f35bfae6 > Reviewed-on: https://skia-review.googlesource.com/132405 > Commit-Queue: Brian Salomon > Reviewed-by: Chris Dalton TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com Change-Id: I4800632515e14fbf54af52826928ac915657b59f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/135661 Reviewed-by: Mike Klein Commit-Queue: Mike Klein --- tests/GrPipelineDynamicStateTest.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'tests/GrPipelineDynamicStateTest.cpp') diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp index 87db111a1a..0f786e7c23 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -58,9 +58,9 @@ struct Vertex { class GrPipelineDynamicStateTestProcessor : public GrGeometryProcessor { public: GrPipelineDynamicStateTestProcessor() - : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) { - this->setVertexAttributeCnt(2); - } + : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) + , fVertex(this->addVertexAttrib("vertex", kHalf2_GrVertexAttribType)) + , fColor(this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType)) {} const char* name() const override { return "GrPipelineDynamicStateTest Processor"; } @@ -68,19 +68,13 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const final; -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}; +protected: + const Attribute& fVertex; + const Attribute& fColor; 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&, @@ -92,10 +86,10 @@ class GLSLPipelineDynamicStateTestProcessor : public GrGLSLGeometryProcessor { GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; varyingHandler->emitAttributes(mp); - varyingHandler->addPassThroughAttribute(mp.kColor, args.fOutputColor); + varyingHandler->addPassThroughAttribute(&mp.fColor, args.fOutputColor); GrGLSLVertexBuilder* v = args.fVertBuilder; - v->codeAppendf("float2 vertex = %s;", mp.kVertex.name()); + v->codeAppendf("float2 vertex = %s;", mp.fVertex.name()); gpArgs->fPositionVar.set(kFloat2_GrSLType, "vertex"); GrGLSLFPFragmentBuilder* f = args.fFragBuilder; -- cgit v1.2.3