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 |
11 #include "GrGLShaderBuilder.h" | 11 #include "GrGLShaderBuilder.h" |
12 | 12 |
13 class GrGLProgramBuilder; | 13 class GrGLProgramBuilder; |
14 | 14 |
15 // TODO we only actually ever need to return a GrGLShaderBuilder for this guy, n
one of the below | 15 // TODO we only actually ever need to return a GrGLShaderBuilder for this guy, n
one of the below |
16 // functions need to be part of VertexShaderBuilder's public interface | 16 // functions need to be part of VertexShaderBuilder's public interface |
17 class GrGLVertexBuilder : public GrGLShaderBuilder { | 17 class GrGLVertexBuilder : public GrGLShaderBuilder { |
18 public: | 18 public: |
19 GrGLVertexBuilder(GrGLProgramBuilder* program); | 19 GrGLVertexBuilder(GrGLProgramBuilder* program); |
20 | 20 |
21 /** | 21 /** |
22 * Are explicit local coordinates provided as input to the vertex shader. | 22 * Are explicit local coordinates provided as input to the vertex shader. |
23 */ | 23 */ |
24 bool hasExplicitLocalCoords() const { return (fLocalCoordsVar != fPositionVa
r); } | 24 bool hasLocalCoords() const { return (fLocalCoordsVar != fPositionVar); } |
25 | 25 |
26 /** Returns a vertex attribute that represents the local coords in the VS. T
his may be the same | 26 /** Returns a vertex attribute that represents the local coords in the VS. T
his may be the same |
27 as positionAttribute() or it may not be. It depends upon whether the ren
dering code | 27 as positionAttribute() or it may not be. It depends upon whether the ren
dering code |
28 specified explicit local coords or not in the GrDrawState. */ | 28 specified explicit local coords or not in the GrDrawState. */ |
29 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar;
} | 29 const GrGLShaderVar& localCoordsAttribute() const { return *fLocalCoordsVar;
} |
30 | 30 |
31 /** Returns a vertex attribute that represents the vertex position in the VS
. This is the | 31 /** Returns a vertex attribute that represents the vertex position in the VS
. This is the |
32 pre-matrix position and is commonly used by effects to compute texture c
oords via a matrix. | 32 pre-matrix position and is commonly used by effects to compute texture c
oords via a matrix. |
33 */ | 33 */ |
34 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } | 34 const GrGLShaderVar& positionAttribute() const { return *fPositionVar; } |
(...skipping 26 matching lines...) Expand all Loading... |
61 }; | 61 }; |
62 | 62 |
63 GrGLShaderVar* fPositionVar; | 63 GrGLShaderVar* fPositionVar; |
64 GrGLShaderVar* fLocalCoordsVar; | 64 GrGLShaderVar* fLocalCoordsVar; |
65 int fEffectAttribOffset; | 65 int fEffectAttribOffset; |
66 | 66 |
67 typedef GrGLShaderBuilder INHERITED; | 67 typedef GrGLShaderBuilder INHERITED; |
68 }; | 68 }; |
69 | 69 |
70 #endif | 70 #endif |
OLD | NEW |