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 |
11 #include "gl/GrGLProgramDataManager.h" | 11 #include "gl/GrGLProgramDataManager.h" |
12 #include "glsl/GrGLSLProgramBuilder.h" | 12 #include "glsl/GrGLSLProgramBuilder.h" |
13 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
14 #include "glsl/GrGLSLTextureSampler.h" | 14 #include "glsl/GrGLSLTextureSampler.h" |
15 #include "../GrGLPrimitiveProcessor.h" | 15 #include "../GrGLPrimitiveProcessor.h" |
16 #include "../GrGLXferProcessor.h" | 16 #include "../GrGLXferProcessor.h" |
17 #include "../../GrPipeline.h" | 17 #include "../../GrPipeline.h" |
18 | 18 |
19 class GrFragmentProcessor; | 19 class GrFragmentProcessor; |
20 class GrGLContextInfo; | 20 class GrGLContextInfo; |
21 class GrGLShaderBuilder; | 21 class GrGLSLShaderBuilder; |
22 class GrGLSLCaps; | 22 class GrGLSLCaps; |
23 | 23 |
24 // Enough precision to represent 1 / 2048 accurately in printf | |
25 #define GR_SIGNIFICANT_POW2_DECIMAL_DIG 11 | |
26 | |
27 /** | 24 /** |
28 * The below struct represent processors installed in programs. | 25 * The below struct represent processors installed in programs. |
29 */ | 26 */ |
30 template <class Proc> | 27 template <class Proc> |
31 struct GrGLInstalledProc { | 28 struct GrGLInstalledProc { |
32 SkDEBUGCODE(int fSamplersIdx;) | 29 SkDEBUGCODE(int fSamplersIdx;) |
33 SkAutoTDelete<Proc> fGLProc; | 30 SkAutoTDelete<Proc> fGLProc; |
34 }; | 31 }; |
35 | 32 |
36 typedef GrGLInstalledProc<GrGLPrimitiveProcessor> GrGLInstalledGeoProc; | 33 typedef GrGLInstalledProc<GrGLPrimitiveProcessor> GrGLInstalledGeoProc; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const GrGLSLExpr4& coverageIn); | 125 const GrGLSLExpr4& coverageIn); |
129 | 126 |
130 void verify(const GrPrimitiveProcessor&); | 127 void verify(const GrPrimitiveProcessor&); |
131 void verify(const GrXferProcessor&); | 128 void verify(const GrXferProcessor&); |
132 void verify(const GrFragmentProcessor&); | 129 void verify(const GrFragmentProcessor&); |
133 template <class Proc> | 130 template <class Proc> |
134 void emitSamplers(const GrProcessor&, | 131 void emitSamplers(const GrProcessor&, |
135 GrGLSLTextureSampler::TextureSamplerArray* outSamplers, | 132 GrGLSLTextureSampler::TextureSamplerArray* outSamplers, |
136 GrGLInstalledProc<Proc>*); | 133 GrGLInstalledProc<Proc>*); |
137 | 134 |
138 bool compileAndAttachShaders(GrGLShaderBuilder& shader, | 135 bool compileAndAttachShaders(GrGLSLShaderBuilder& shader, |
139 GrGLuint programId, | 136 GrGLuint programId, |
140 GrGLenum type, | 137 GrGLenum type, |
141 SkTDArray<GrGLuint>* shaderIds); | 138 SkTDArray<GrGLuint>* shaderIds); |
142 GrGLProgram* finalize(); | 139 GrGLProgram* finalize(); |
143 void bindProgramResourceLocations(GrGLuint programID); | 140 void bindProgramResourceLocations(GrGLuint programID); |
144 bool checkLinkStatus(GrGLuint programID); | 141 bool checkLinkStatus(GrGLuint programID); |
145 void resolveProgramResourceLocations(GrGLuint programID); | 142 void resolveProgramResourceLocations(GrGLuint programID); |
146 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs
); | 143 void cleanupProgram(GrGLuint programID, const SkTDArray<GrGLuint>& shaderIDs
); |
147 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs); | 144 void cleanupShaders(const SkTDArray<GrGLuint>& shaderIDs); |
148 | 145 |
(...skipping 28 matching lines...) Expand all Loading... |
177 GrGLInstalledXferProc* fXferProcessor; | 174 GrGLInstalledXferProc* fXferProcessor; |
178 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; | 175 SkAutoTUnref<GrGLInstalledFragProcs> fFragmentProcessors; |
179 | 176 |
180 GrGLGpu* fGpu; | 177 GrGLGpu* fGpu; |
181 UniformInfoArray fUniforms; | 178 UniformInfoArray fUniforms; |
182 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; | 179 GrGLPrimitiveProcessor::TransformsIn fCoordTransforms; |
183 GrGLPrimitiveProcessor::TransformsOut fOutCoords; | 180 GrGLPrimitiveProcessor::TransformsOut fOutCoords; |
184 SkTArray<UniformHandle> fSamplerUniforms; | 181 SkTArray<UniformHandle> fSamplerUniforms; |
185 SeparableVaryingInfoArray fSeparableVaryingInfos; | 182 SeparableVaryingInfoArray fSeparableVaryingInfos; |
186 | 183 |
187 friend class GrGLShaderBuilder; | 184 friend class GrGLSLShaderBuilder; |
188 friend class GrGLVertexBuilder; | 185 friend class GrGLSLVertexBuilder; |
189 friend class GrGLFragmentShaderBuilder; | 186 friend class GrGLSLFragmentShaderBuilder; |
190 friend class GrGLGeometryBuilder; | 187 friend class GrGLSLGeometryBuilder; |
191 | 188 |
192 typedef GrGLSLProgramBuilder INHERITED; | 189 typedef GrGLSLProgramBuilder INHERITED; |
193 }; | 190 }; |
194 #endif | 191 #endif |
OLD | NEW |