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 12 matching lines...) Expand all Loading... |
23 * Heirarchy: | 23 * Heirarchy: |
24 * GrGLUniformBuilder | 24 * GrGLUniformBuilder |
25 * / \ | 25 * / \ |
26 * GrGLFPBuilder GrGLGPBuilder | 26 * GrGLFPBuilder GrGLGPBuilder |
27 * \ / | 27 * \ / |
28 * GrGLProgramBuilder(internal use only) | 28 * GrGLProgramBuilder(internal use only) |
29 */ | 29 */ |
30 class GrGLUniformBuilder { | 30 class GrGLUniformBuilder { |
31 public: | 31 public: |
32 enum ShaderVisibility { | 32 enum ShaderVisibility { |
33 kVertex_Visibility = 0x1, | 33 kVertex_Visibility = 1 << kVertex_GrShaderType, |
34 kGeometry_Visibility = 0x2, | 34 kGeometry_Visibility = 1 << kGeometry_GrShaderType, |
35 kFragment_Visibility = 0x4, | 35 kFragment_Visibility = 1 << kFragment_GrShaderType, |
36 }; | 36 }; |
37 | 37 |
38 virtual ~GrGLUniformBuilder() {} | 38 virtual ~GrGLUniformBuilder() {} |
39 | 39 |
40 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 40 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
41 | 41 |
42 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. | 42 /** Add a uniform variable to the current program, that has visibility in on
e or more shaders. |
43 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the | 43 visibility is a bitfield of ShaderVisibility values indicating from whic
h shaders the |
44 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not | 44 uniform should be accessible. At least one bit must be set. Geometry sha
der uniforms are not |
45 supported at this time. The actual uniform name will be mangled. If outN
ame is not NULL then | 45 supported at this time. The actual uniform name will be mangled. If outN
ame is not NULL then |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 int stageIndex() const { return fStageIndex; } | 337 int stageIndex() const { return fStageIndex; } |
338 | 338 |
339 struct TransformVarying { | 339 struct TransformVarying { |
340 TransformVarying(const GrGLVarying& v, const char* uniName, const char*
sourceCoords) | 340 TransformVarying(const GrGLVarying& v, const char* uniName, const char*
sourceCoords) |
341 : fV(v), fUniName(uniName), fSourceCoords(sourceCoords) {} | 341 : fV(v), fUniName(uniName), fSourceCoords(sourceCoords) {} |
342 GrGLVarying fV; | 342 GrGLVarying fV; |
343 SkString fUniName; | 343 SkString fUniName; |
344 SkString fSourceCoords; | 344 SkString fSourceCoords; |
345 }; | 345 }; |
346 | 346 |
347 void addCoordVarying(const char* name, GrGLVarying* v, const char* uniName, | |
348 const char* sourceCoords) { | |
349 this->addVarying(name, v); | |
350 fCoordVaryings.push_back(TransformVarying(*v, uniName, sourceCoords)); | |
351 } | |
352 | |
353 const char* rtAdjustment() const { return "rtAdjustment"; } | 347 const char* rtAdjustment() const { return "rtAdjustment"; } |
354 | 348 |
355 // number of each input/output type in a single allocation block, used by ma
ny builders | 349 // number of each input/output type in a single allocation block, used by ma
ny builders |
356 static const int kVarsPerBlock; | 350 static const int kVarsPerBlock; |
357 | 351 |
358 BuiltinUniformHandles fUniformHandles; | 352 BuiltinUniformHandles fUniformHandles; |
359 GrGLVertexBuilder fVS; | 353 GrGLVertexBuilder fVS; |
360 GrGLGeometryBuilder fGS; | 354 GrGLGeometryBuilder fGS; |
361 GrGLFragmentShaderBuilder fFS; | 355 GrGLFragmentShaderBuilder fFS; |
362 bool fOutOfStage; | 356 bool fOutOfStage; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 SkAutoTDelete<GrGLFragmentProcessor> fGLProc; | 417 SkAutoTDelete<GrGLFragmentProcessor> fGLProc; |
424 SkSTArray<2, Transform, true> fTransforms; | 418 SkSTArray<2, Transform, true> fTransforms; |
425 }; | 419 }; |
426 | 420 |
427 struct GrGLInstalledFragProcs : public SkRefCnt { | 421 struct GrGLInstalledFragProcs : public SkRefCnt { |
428 virtual ~GrGLInstalledFragProcs(); | 422 virtual ~GrGLInstalledFragProcs(); |
429 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; | 423 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; |
430 }; | 424 }; |
431 | 425 |
432 #endif | 426 #endif |
OLD | NEW |