Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: src/gpu/effects/GrGeometryProcessor.h

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/effects/GrGeometryProcessor.h
diff --git a/src/gpu/effects/GrVertexEffect.h b/src/gpu/effects/GrGeometryProcessor.h
similarity index 59%
rename from src/gpu/effects/GrVertexEffect.h
rename to src/gpu/effects/GrGeometryProcessor.h
index 323c85e34e11501bc5260b0d0ad75b1ac38abb93..0879f64123297601a1a52e09a3091c995f01d1ff 100644
--- a/src/gpu/effects/GrVertexEffect.h
+++ b/src/gpu/effects/GrGeometryProcessor.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrVertexEffect_DEFINED
-#define GrVertexEffect_DEFINED
+#ifndef GrGeometryProcessor_DEFINED
+#define GrGeometryProcessor_DEFINED
#include "GrEffect.h"
@@ -15,19 +15,22 @@
* Otherwise it won't be able to add vertex attribs, and it might be given a vertexless shader
* program in emitCode.
*/
-class GrVertexEffect : public GrEffect {
+class GrGeometryProcessor : public GrEffect {
public:
- GrVertexEffect() { fRequiresVertexShader = true; }
+ GrGeometryProcessor() { fRequiresVertexShader = true; }
protected:
/**
* Subclasses call this from their constructor to register vertex attributes (at most
* kMaxVertexAttribs). This must only be called from the constructor because GrEffects are
* immutable.
+ *
+ * We return a reference to the added var so that derived classes can name it nicely and use it
+ * in shader code.
*/
- void addVertexAttrib(GrSLType type) {
- SkASSERT(fVertexAttribTypes.count() < kMaxVertexAttribs);
- fVertexAttribTypes.push_back(type);
+ GrShaderVar& addVertexAttrib(const GrShaderVar& var) {
bsalomon 2014/09/12 00:34:17 I think this should just take a type and a name (a
joshua.litt 2014/09/12 00:46:07 Non const ref was a mistake, I meant to return a c
egdaniel 2014/09/12 01:12:27 Do we want to be dealing precision issues at this
bsalomon 2014/09/12 01:17:47 I think you're right that we don't need precision
joshua.litt 2014/09/12 01:35:28 I can remove precision from GrShaderVar along with
egdaniel 2014/09/12 02:09:18 I was suggesting removing precision from GrShaderV
+ SkASSERT(fVertexAttribs.count() < kMaxVertexAttribs);
+ return fVertexAttribs.push_back(var);
}
private:

Powered by Google App Engine
This is Rietveld 408576698