| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLVertexShader_DEFINED | 8 #ifndef GrGLVertexShader_DEFINED |
| 9 #define GrGLVertexShader_DEFINED | 9 #define GrGLVertexShader_DEFINED |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 /** Returns a vertex attribute that represents the local coords in the VS. T
his may be the same | 24 /** Returns a vertex attribute that represents the local coords in the VS. T
his may be the same |
| 25 as positionAttribute() or it may not be. It depends upon whether the ren
dering code | 25 as positionAttribute() or it may not be. It depends upon whether the ren
dering code |
| 26 specified explicit local coords or not in the GrDrawState. */ | 26 specified explicit local coords or not in the GrDrawState. */ |
| 27 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar;
} | 27 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar;
} |
| 28 | 28 |
| 29 /** Returns a vertex attribute that represents the vertex position in the VS
. This is the | 29 /** Returns a vertex attribute that represents the vertex position in the VS
. This is the |
| 30 pre-matrix position and is commonly used by effects to compute texture c
oords via a matrix. | 30 pre-matrix position and is commonly used by effects to compute texture c
oords via a matrix. |
| 31 */ | 31 */ |
| 32 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } | 32 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } |
| 33 | 33 |
| 34 /** returns the expected position output */ | |
| 35 const char* glPosition() const { return "pos3"; } | |
| 36 | |
| 37 /** returns the expected uviewM matrix */ | |
| 38 // TODO all of this fixed function stuff can live on the GP/PP | |
| 39 const char* uViewM() const { return "uViewM"; } | |
| 40 const char* inPosition() const { return "inPosition"; } | |
| 41 | |
| 42 | |
| 43 private: | 34 private: |
| 44 /* | 35 /* |
| 45 * Internal call for GrGLProgramBuilder.addVarying | 36 * Internal call for GrGLProgramBuilder.addVarying |
| 46 */ | 37 */ |
| 47 void addVarying(const char* name, GrGLVarying*); | 38 void addVarying(const char* name, GrGLVarying*); |
| 48 | 39 |
| 49 /* | 40 /* |
| 50 * private helpers for compilation by GrGLProgramBuilder | 41 * private helpers for compilation by GrGLProgramBuilder |
| 51 */ | 42 */ |
| 52 void transformToNormalizedDeviceSpace(); | 43 void setupLocalCoords(); |
| 53 //TODO GP itself should setup the uniform view matrix | 44 void transformGLToSkiaCoords(); |
| 54 void setupUniformViewMatrix(); | |
| 55 void setupPositionAndLocalCoords(); | |
| 56 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out); | 45 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out); |
| 57 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); | 46 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); |
| 58 void emitAttributes(const GrGeometryProcessor& gp); | 47 void emitAttributes(const GrGeometryProcessor& gp); |
| 48 void transformSkiaToGLCoords(); |
| 59 void bindVertexAttributes(GrGLuint programID); | 49 void bindVertexAttributes(GrGLuint programID); |
| 60 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; | 50 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; |
| 61 | 51 |
| 62 // an internal call which checks for uniquness of a var before adding it to
the list of inputs | 52 // an internal call which checks for uniquness of a var before adding it to
the list of inputs |
| 63 bool addAttribute(const GrShaderVar& var); | 53 bool addAttribute(const GrShaderVar& var); |
| 64 struct AttributePair { | 54 struct AttributePair { |
| 65 void set(int index, const SkString& name) { | 55 void set(int index, const SkString& name) { |
| 66 fIndex = index; fName = name; | 56 fIndex = index; fName = name; |
| 67 } | 57 } |
| 68 int fIndex; | 58 int fIndex; |
| 69 SkString fName; | 59 SkString fName; |
| 70 }; | 60 }; |
| 71 | 61 |
| 72 GrGLShaderVar* fPositionVar; | 62 GrGLShaderVar* fPositionVar; |
| 73 GrGLShaderVar* fLocalCoordsVar; | 63 GrGLShaderVar* fLocalCoordsVar; |
| 74 const char* fRtAdjustName; | |
| 75 int fEffectAttribOffset; | 64 int fEffectAttribOffset; |
| 76 | 65 |
| 77 friend class GrGLProgramBuilder; | 66 friend class GrGLProgramBuilder; |
| 78 | 67 |
| 79 typedef GrGLShaderBuilder INHERITED; | 68 typedef GrGLShaderBuilder INHERITED; |
| 80 }; | 69 }; |
| 81 | 70 |
| 82 #endif | 71 #endif |
| OLD | NEW |