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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // origin_upper_left is not supported. | 216 // origin_upper_left is not supported. |
217 UniformHandle fRTHeightUni; | 217 UniformHandle fRTHeightUni; |
218 | 218 |
219 // Uniforms for computing texture coords to do the dst-copy lookup | 219 // Uniforms for computing texture coords to do the dst-copy lookup |
220 UniformHandle fDstCopyTopLeftUni; | 220 UniformHandle fDstCopyTopLeftUni; |
221 UniformHandle fDstCopyScaleUni; | 221 UniformHandle fDstCopyScaleUni; |
222 UniformHandle fDstCopySamplerUni; | 222 UniformHandle fDstCopySamplerUni; |
223 }; | 223 }; |
224 | 224 |
225 protected: | 225 protected: |
226 typedef GrProgramDesc::ProcKeyProvider ProcKeyProvider; | |
227 typedef GrGLProgramDataManager::UniformInfo UniformInfo; | 226 typedef GrGLProgramDataManager::UniformInfo UniformInfo; |
228 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 227 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
229 | 228 |
230 static GrGLProgramBuilder* CreateProgramBuilder(const GrOptDrawState&, | 229 static GrGLProgramBuilder* CreateProgramBuilder(const GrOptDrawState&, |
231 GrGpu::DrawType, | 230 GrGpu::DrawType, |
232 bool hasGeometryProcessor, | 231 bool hasGeometryProcessor, |
233 GrGpuGL*); | 232 GrGpuGL*); |
234 | 233 |
235 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&); | 234 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&); |
236 | 235 |
237 const GrOptDrawState& optState() const { return fOptState; } | 236 const GrOptDrawState& optState() const { return fOptState; } |
238 const GrProgramDesc& desc() const { return fDesc; } | 237 const GrProgramDesc& desc() const { return fDesc; } |
239 const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } | 238 const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } |
240 | 239 |
241 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix | 240 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix |
242 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're | 241 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're |
243 // generating stage code. | 242 // generating stage code. |
244 void nameVariable(SkString* out, char prefix, const char* name); | 243 void nameVariable(SkString* out, char prefix, const char* name); |
245 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp
r1* inputCoverage); | 244 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp
r1* inputCoverage); |
246 void emitAndInstallProcs(GrGLSLExpr4* inputColor, | 245 void emitAndInstallProcs(GrGLSLExpr4* inputColor, |
247 GrGLSLExpr4* inputCoverage); | 246 GrGLSLExpr4* inputCoverage); |
248 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
t); | 247 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
t); |
249 template <class Proc> | 248 template <class Proc> |
250 void emitAndInstallProc(const Proc&, | 249 void emitAndInstallProc(const Proc&, |
251 int index, | 250 int index, |
252 const ProcKeyProvider&, | |
253 const GrGLSLExpr4& input, | 251 const GrGLSLExpr4& input, |
254 GrGLSLExpr4* output); | 252 GrGLSLExpr4* output); |
255 | 253 |
256 // these emit functions help to keep the createAndEmitProcessors template ge
neral | 254 // these emit functions help to keep the createAndEmitProcessors template ge
neral |
257 void emitAndInstallProc(const GrPendingFragmentStage&, | 255 void emitAndInstallProc(const GrPendingFragmentStage&, |
258 const GrProcessorKey&, | |
259 const char* outColor, | 256 const char* outColor, |
260 const char* inColor); | 257 const char* inColor); |
261 void emitAndInstallProc(const GrGeometryProcessor&, | 258 void emitAndInstallProc(const GrGeometryProcessor&, |
262 const GrProcessorKey&, | |
263 const char* outCoverage, | 259 const char* outCoverage, |
264 const char* inCoverage); | 260 const char* inCoverage); |
265 void verify(const GrGeometryProcessor&); | 261 void verify(const GrGeometryProcessor&); |
266 void verify(const GrFragmentProcessor&); | 262 void verify(const GrFragmentProcessor&); |
267 void emitSamplers(const GrProcessor&, | 263 void emitSamplers(const GrProcessor&, |
268 GrGLProcessor::TextureSamplerArray* outSamplers, | 264 GrGLProcessor::TextureSamplerArray* outSamplers, |
269 GrGLInstalledProc*); | 265 GrGLInstalledProc*); |
270 | 266 |
271 // each specific program builder has a distinct transform and must override
this function | 267 // each specific program builder has a distinct transform and must override
this function |
272 virtual void emitTransforms(const GrPendingFragmentStage&, | 268 virtual void emitTransforms(const GrPendingFragmentStage&, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SkSTArray<2, Transform, true> fTransforms; | 399 SkSTArray<2, Transform, true> fTransforms; |
404 bool fLocalCoordAttrib; | 400 bool fLocalCoordAttrib; |
405 }; | 401 }; |
406 | 402 |
407 struct GrGLInstalledFragProcs : public SkRefCnt { | 403 struct GrGLInstalledFragProcs : public SkRefCnt { |
408 virtual ~GrGLInstalledFragProcs(); | 404 virtual ~GrGLInstalledFragProcs(); |
409 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; | 405 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; |
410 }; | 406 }; |
411 | 407 |
412 #endif | 408 #endif |
OLD | NEW |