OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLProgramEffects_DEFINED | 8 #ifndef GrGLProgramEffects_DEFINED |
9 #define GrGLProgramEffects_DEFINED | 9 #define GrGLProgramEffects_DEFINED |
10 | 10 |
11 #include "GrBackendEffectFactory.h" | 11 #include "GrBackendEffectFactory.h" |
12 #include "GrTexture.h" | 12 #include "GrTexture.h" |
13 #include "GrTextureAccess.h" | 13 #include "GrTextureAccess.h" |
14 #include "GrGLUniformManager.h" | 14 #include "GrGLUniformManager.h" |
15 | 15 |
16 class GrEffectStage; | 16 class GrEffectStage; |
17 class GrGLVertexProgramEffectsBuilder; | 17 class GrGLVertexProgramEffectsBuilder; |
18 class GrGLShaderBuilder; | 18 class GrGLShaderBuilder; |
19 class GrGLFullShaderBuilder; | 19 class GrGLFullShaderBuilder; |
20 class GrGLFragmentOnlyShaderBuilder; | 20 class GrGLFragmentOnlyShaderBuilder; |
21 | 21 |
22 /** | 22 /** |
23 * This class encapsulates an array of GrGLEffects and their supporting data (co
ord transforms | 23 * This class encapsulates an array of GrGLEffects and their supporting data (co
ord transforms |
24 * and textures). It is built with GrGLProgramEffectsBuilder, then used to manag
e the necessary GL | 24 * and textures). It is built with GrGLProgramEffectsBuilder, then used to manag
e the necessary GL |
25 * state and shader uniforms. | 25 * state and shader uniforms. |
26 */ | 26 */ |
27 class GrGLProgramEffects { | 27 class GrGLProgramEffects : public SkRefCnt { |
28 public: | 28 public: |
29 typedef GrBackendEffectFactory::EffectKey EffectKey; | 29 typedef GrBackendEffectFactory::EffectKey EffectKey; |
30 typedef GrGLUniformManager::UniformHandle UniformHandle; | 30 typedef GrGLUniformManager::UniformHandle UniformHandle; |
31 | 31 |
32 /** | 32 /** |
33 * These methods generate different portions of an effect's final key. | 33 * These methods generate different portions of an effect's final key. |
34 */ | 34 */ |
35 static EffectKey GenAttribKey(const GrDrawEffect&); | 35 static EffectKey GenAttribKey(const GrDrawEffect&); |
36 static EffectKey GenTransformKey(const GrDrawEffect&); | 36 static EffectKey GenTransformKey(const GrDrawEffect&); |
37 static EffectKey GenTextureKey(const GrDrawEffect&, const GrGLCaps&); | 37 static EffectKey GenTextureKey(const GrDrawEffect&, const GrGLCaps&); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void bindTextures(GrGpuGL*, const GrEffectRef&, int effectIdx); | 115 void bindTextures(GrGpuGL*, const GrEffectRef&, int effectIdx); |
116 | 116 |
117 struct Sampler { | 117 struct Sampler { |
118 SkDEBUGCODE(Sampler() : fTextureUnit(-1) {}) | 118 SkDEBUGCODE(Sampler() : fTextureUnit(-1) {}) |
119 UniformHandle fUniform; | 119 UniformHandle fUniform; |
120 int fTextureUnit; | 120 int fTextureUnit; |
121 }; | 121 }; |
122 | 122 |
123 SkTArray<GrGLEffect*> fGLEffects; | 123 SkTArray<GrGLEffect*> fGLEffects; |
124 SkTArray<SkSTArray<4, Sampler, true> > fSamplers; | 124 SkTArray<SkSTArray<4, Sampler, true> > fSamplers; |
| 125 |
| 126 private: |
| 127 typedef SkRefCnt INHERITED; |
125 }; | 128 }; |
126 | 129 |
127 /** | 130 /** |
128 * This is an abstract base class for constructing different types of GrGLProgra
mEffects objects. | 131 * This is an abstract base class for constructing different types of GrGLProgra
mEffects objects. |
129 */ | 132 */ |
130 class GrGLProgramEffectsBuilder { | 133 class GrGLProgramEffectsBuilder { |
131 public: | 134 public: |
132 virtual ~GrGLProgramEffectsBuilder() { } | 135 virtual ~GrGLProgramEffectsBuilder() { } |
133 | 136 |
134 /** | 137 /** |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } | 319 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } |
317 | 320 |
318 private: | 321 private: |
319 GrGLFragmentOnlyShaderBuilder* fBuilder; | 322 GrGLFragmentOnlyShaderBuilder* fBuilder; |
320 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; | 323 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; |
321 | 324 |
322 typedef GrGLProgramEffectsBuilder INHERITED; | 325 typedef GrGLProgramEffectsBuilder INHERITED; |
323 }; | 326 }; |
324 | 327 |
325 #endif | 328 #endif |
OLD | NEW |