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 |
34 private: | 43 private: |
35 /* | 44 /* |
36 * Internal call for GrGLProgramBuilder.addVarying | 45 * Internal call for GrGLProgramBuilder.addVarying |
37 */ | 46 */ |
38 void addVarying(const char* name, GrGLVarying*); | 47 void addVarying(const char* name, GrGLVarying*); |
39 | 48 |
40 /* | 49 /* |
41 * private helpers for compilation by GrGLProgramBuilder | 50 * private helpers for compilation by GrGLProgramBuilder |
42 */ | 51 */ |
43 void setupLocalCoords(); | 52 void transformToNormalizedDeviceSpace(); |
44 void transformGLToSkiaCoords(); | 53 //TODO GP itself should setup the uniform view matrix |
| 54 void setupUniformViewMatrix(); |
| 55 void setupPositionAndLocalCoords(); |
45 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out); | 56 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out); |
46 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); | 57 void setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr4* out); |
47 void emitAttributes(const GrGeometryProcessor& gp); | 58 void emitAttributes(const GrGeometryProcessor& gp); |
48 void transformSkiaToGLCoords(); | |
49 void bindVertexAttributes(GrGLuint programID); | 59 void bindVertexAttributes(GrGLuint programID); |
50 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; | 60 bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>* shader
Ids) const; |
51 | 61 |
52 // an internal call which checks for uniquness of a var before adding it to
the list of inputs | 62 // an internal call which checks for uniquness of a var before adding it to
the list of inputs |
53 bool addAttribute(const GrShaderVar& var); | 63 bool addAttribute(const GrShaderVar& var); |
54 struct AttributePair { | 64 struct AttributePair { |
55 void set(int index, const SkString& name) { | 65 void set(int index, const SkString& name) { |
56 fIndex = index; fName = name; | 66 fIndex = index; fName = name; |
57 } | 67 } |
58 int fIndex; | 68 int fIndex; |
59 SkString fName; | 69 SkString fName; |
60 }; | 70 }; |
61 | 71 |
62 GrGLShaderVar* fPositionVar; | 72 GrGLShaderVar* fPositionVar; |
63 GrGLShaderVar* fLocalCoordsVar; | 73 GrGLShaderVar* fLocalCoordsVar; |
| 74 const char* fRtAdjustName; |
64 int fEffectAttribOffset; | 75 int fEffectAttribOffset; |
65 | 76 |
66 friend class GrGLProgramBuilder; | 77 friend class GrGLProgramBuilder; |
67 | 78 |
68 typedef GrGLShaderBuilder INHERITED; | 79 typedef GrGLShaderBuilder INHERITED; |
69 }; | 80 }; |
70 | 81 |
71 #endif | 82 #endif |
OLD | NEW |