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

Unified Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.h

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding test to ignore Created 6 years 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
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLVertexShaderBuilder.h
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h b/src/gpu/gl/builders/GrGLVertexShaderBuilder.h
index 7d6d95e5080c0fe0e8f5018ec57258158f2d9eec..dbff24fe838606f3ae45d8a158f4afb1b2a66bf4 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.h
@@ -16,29 +16,20 @@ class GrGLVertexBuilder : public GrGLShaderBuilder {
public:
GrGLVertexBuilder(GrGLProgramBuilder* program);
- /**
- * Are explicit local coordinates provided as input to the vertex shader.
- */
- bool hasLocalCoords() const { return (fLocalCoordsVar != fPositionVar); }
-
- /** Returns a vertex attribute that represents the local coords in the VS. This may be the same
- as positionAttribute() or it may not be. It depends upon whether the rendering code
- specified explicit local coords or not in the GrDrawState. */
- const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar; }
-
- /** Returns a vertex attribute that represents the vertex position in the VS. This is the
- pre-matrix position and is commonly used by effects to compute texture coords via a matrix.
- */
- const GrGLShaderVar& positionAttribute() const { return *fPositionVar; }
-
/** returns the expected position output */
const char* glPosition() const { return "pos3"; }
+ const char* positionCoords() const { return "position"; }
+ const char* localCoords() const { return "localCoords"; }
/** returns the expected uviewM matrix */
// TODO all of this fixed function stuff can live on the GP/PP
const char* uViewM() const { return "uViewM"; }
- const char* inPosition() const { return "inPosition"; }
+ void addAttribute(const GrGeometryProcessor::GrAttribute* attr) {
+ this->addAttribute(GrShaderVar(attr->fName,
+ GrVertexAttribTypeToSLType(attr->fType),
+ GrShaderVar::kAttribute_TypeModifier));
+ }
private:
/*
@@ -52,27 +43,14 @@ private:
void transformToNormalizedDeviceSpace();
//TODO GP itself should setup the uniform view matrix
void setupUniformViewMatrix();
- void setupPositionAndLocalCoords();
- void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out);
- void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out);
void emitAttributes(const GrGeometryProcessor& gp);
void bindVertexAttributes(GrGLuint programID);
bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shaderIds) const;
// an internal call which checks for uniquness of a var before adding it to the list of inputs
bool addAttribute(const GrShaderVar& var);
- struct AttributePair {
- void set(int index, const SkString& name) {
- fIndex = index; fName = name;
- }
- int fIndex;
- SkString fName;
- };
- GrGLShaderVar* fPositionVar;
- GrGLShaderVar* fLocalCoordsVar;
- const char* fRtAdjustName;
- int fEffectAttribOffset;
+ const char* fRtAdjustName;
friend class GrGLProgramBuilder;
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698