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 GrGLProgramBuilder_DEFINED | 8 #ifndef GrGLProgramBuilder_DEFINED |
9 #define GrGLProgramBuilder_DEFINED | 9 #define GrGLProgramBuilder_DEFINED |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 }; | 42 }; |
43 | 43 |
44 virtual ~GrGLUniformBuilder() {} | 44 virtual ~GrGLUniformBuilder() {} |
45 | 45 |
46 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 46 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
47 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH
andle; | 47 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH
andle; |
48 | 48 |
49 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. | 49 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. |
50 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the | 50 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the |
51 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not | 51 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not |
52 supported at this time. The actual uniform name will be mangled. If outN
ame is not NULL then | 52 supported at this time. The actual uniform name will be mangled. If outN
ame is not nullptr then |
53 it will refer to the final uniform name after return. Use the addUniform
Array variant to add | 53 it will refer to the final uniform name after return. Use the addUniform
Array variant to add |
54 an array of uniforms. */ | 54 an array of uniforms. */ |
55 UniformHandle addUniform(uint32_t visibility, | 55 UniformHandle addUniform(uint32_t visibility, |
56 GrSLType type, | 56 GrSLType type, |
57 GrSLPrecision precision, | 57 GrSLPrecision precision, |
58 const char* name, | 58 const char* name, |
59 const char** outName = NULL) { | 59 const char** outName = nullptr) { |
60 return this->addUniformArray(visibility, type, precision, name, 0, outNa
me); | 60 return this->addUniformArray(visibility, type, precision, name, 0, outNa
me); |
61 } | 61 } |
62 | 62 |
63 virtual UniformHandle addUniformArray( | 63 virtual UniformHandle addUniformArray( |
64 uint32_t visibility, | 64 uint32_t visibility, |
65 GrSLType type, | 65 GrSLType type, |
66 GrSLPrecision precision, | 66 GrSLPrecision precision, |
67 const char* name, | 67 const char* name, |
68 int arrayCount, | 68 int arrayCount, |
69 const char** outName = NULL) = 0; | 69 const char** outName = nullptr) = 0; |
70 | 70 |
71 virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const = 0; | 71 virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const = 0; |
72 | 72 |
73 /** | 73 /** |
74 * Shortcut for getUniformVariable(u).c_str() | 74 * Shortcut for getUniformVariable(u).c_str() |
75 */ | 75 */ |
76 virtual const char* getUniformCStr(UniformHandle u) const = 0; | 76 virtual const char* getUniformCStr(UniformHandle u) const = 0; |
77 | 77 |
78 virtual const GrGLContextInfo& ctxInfo() const = 0; | 78 virtual const GrGLContextInfo& ctxInfo() const = 0; |
79 | 79 |
(...skipping 18 matching lines...) Expand all Loading... |
98 GrSLType type() const { return fType; } | 98 GrSLType type() const { return fType; } |
99 | 99 |
100 protected: | 100 protected: |
101 enum Varying { | 101 enum Varying { |
102 kVertToFrag_Varying, | 102 kVertToFrag_Varying, |
103 kVertToGeo_Varying, | 103 kVertToGeo_Varying, |
104 kGeoToFrag_Varying, | 104 kGeoToFrag_Varying, |
105 }; | 105 }; |
106 | 106 |
107 GrGLVarying(GrSLType type, Varying varying) | 107 GrGLVarying(GrSLType type, Varying varying) |
108 : fVarying(varying), fType(type), fVsOut(NULL), fGsIn(NULL), fGsOut(NULL
), | 108 : fVarying(varying), fType(type), fVsOut(nullptr), fGsIn(nullptr), fGsOu
t(nullptr), |
109 fFsIn(NULL) {} | 109 fFsIn(nullptr) {} |
110 | 110 |
111 Varying fVarying; | 111 Varying fVarying; |
112 | 112 |
113 private: | 113 private: |
114 GrSLType fType; | 114 GrSLType fType; |
115 const char* fVsOut; | 115 const char* fVsOut; |
116 const char* fGsIn; | 116 const char* fGsIn; |
117 const char* fGsOut; | 117 const char* fGsOut; |
118 const char* fFsIn; | 118 const char* fFsIn; |
119 | 119 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; | 401 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; |
402 GrGLPrimitiveProcessor::TransformsOut fOutCoords; | 402 GrGLPrimitiveProcessor::TransformsOut fOutCoords; |
403 SkTArray<UniformHandle> fSamplerUniforms; | 403 SkTArray<UniformHandle> fSamplerUniforms; |
404 | 404 |
405 friend class GrGLShaderBuilder; | 405 friend class GrGLShaderBuilder; |
406 friend class GrGLVertexBuilder; | 406 friend class GrGLVertexBuilder; |
407 friend class GrGLFragmentShaderBuilder; | 407 friend class GrGLFragmentShaderBuilder; |
408 friend class GrGLGeometryBuilder; | 408 friend class GrGLGeometryBuilder; |
409 }; | 409 }; |
410 #endif | 410 #endif |
OLD | NEW |