| 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 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void initSamplers(const GrGLProgramDataManager&, int* texUnitIdx); | 50 void initSamplers(const GrGLProgramDataManager&, int* texUnitIdx); |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Calls setData() on each effect, and sets their transformation matrices an
d texture bindings. | 53 * Calls setData() on each effect, and sets their transformation matrices an
d texture bindings. |
| 54 */ | 54 */ |
| 55 virtual void setData(GrGpuGL*, | 55 virtual void setData(GrGpuGL*, |
| 56 GrGpu::DrawType, | 56 GrGpu::DrawType, |
| 57 const GrGLProgramDataManager&, | 57 const GrGLProgramDataManager&, |
| 58 const GrEffectStage* effectStages[]) = 0; | 58 const GrEffectStage* effectStages[]) = 0; |
| 59 | 59 |
| 60 virtual void setData(GrGpuGL*, |
| 61 GrGpu::DrawType, |
| 62 const GrGLProgramDataManager&, |
| 63 const GrEffectStage* effectStages) { SkFAIL("DO NOT USE
"); } |
| 64 |
| 60 void addEffect(GrGLEffect* effect) { fGLEffects.push_back(effect); } | 65 void addEffect(GrGLEffect* effect) { fGLEffects.push_back(effect); } |
| 61 | 66 |
| 62 /** | 67 /** |
| 63 * Passed to GrGLEffects so they can add transformed coordinates to their sh
ader code. | 68 * Passed to GrGLEffects so they can add transformed coordinates to their sh
ader code. |
| 64 */ | 69 */ |
| 65 class TransformedCoords { | 70 class TransformedCoords { |
| 66 public: | 71 public: |
| 67 TransformedCoords(const SkString& name, GrSLType type) | 72 TransformedCoords(const SkString& name, GrSLType type) |
| 68 : fName(name), fType(type) { | 73 : fName(name), fType(type) { |
| 69 } | 74 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 struct Sampler { | 138 struct Sampler { |
| 134 SkDEBUGCODE(Sampler() : fTextureUnit(-1) {}) | 139 SkDEBUGCODE(Sampler() : fTextureUnit(-1) {}) |
| 135 UniformHandle fUniform; | 140 UniformHandle fUniform; |
| 136 int fTextureUnit; | 141 int fTextureUnit; |
| 137 }; | 142 }; |
| 138 | 143 |
| 139 SkTArray<GrGLEffect*> fGLEffects; | 144 SkTArray<GrGLEffect*> fGLEffects; |
| 140 SkTArray<SkSTArray<4, Sampler, true> > fSamplers; | 145 SkTArray<SkSTArray<4, Sampler, true> > fSamplers; |
| 141 | 146 |
| 142 private: | 147 private: |
| 143 friend class GrGLFragmentO; | |
| 144 typedef SkRefCnt INHERITED; | 148 typedef SkRefCnt INHERITED; |
| 145 }; | 149 }; |
| 146 | 150 |
| 147 /** | 151 /** |
| 148 * This is an abstract base class for constructing different types of GrGLProgra
mEffects objects. | 152 * This is an abstract base class for constructing different types of GrGLProgra
mEffects objects. |
| 149 */ | 153 */ |
| 150 class GrGLProgramEffectsBuilder { | 154 class GrGLProgramEffectsBuilder { |
| 151 public: | 155 public: |
| 152 virtual ~GrGLProgramEffectsBuilder() { } | 156 virtual ~GrGLProgramEffectsBuilder() { } |
| 153 /** | 157 /** |
| (...skipping 11 matching lines...) Expand all Loading... |
| 165 /** | 169 /** |
| 166 * This is a GrGLProgramEffects implementation that does coord transforms with t
he vertex shader. | 170 * This is a GrGLProgramEffects implementation that does coord transforms with t
he vertex shader. |
| 167 */ | 171 */ |
| 168 class GrGLVertexProgramEffects : public GrGLProgramEffects { | 172 class GrGLVertexProgramEffects : public GrGLProgramEffects { |
| 169 public: | 173 public: |
| 170 virtual void setData(GrGpuGL*, | 174 virtual void setData(GrGpuGL*, |
| 171 GrGpu::DrawType, | 175 GrGpu::DrawType, |
| 172 const GrGLProgramDataManager&, | 176 const GrGLProgramDataManager&, |
| 173 const GrEffectStage* effectStages[]) SK_OVERRIDE; | 177 const GrEffectStage* effectStages[]) SK_OVERRIDE; |
| 174 | 178 |
| 179 virtual void setData(GrGpuGL*, |
| 180 GrGpu::DrawType, |
| 181 const GrGLProgramDataManager&, |
| 182 const GrEffectStage* effectStages) SK_OVERRIDE; |
| 183 |
| 175 private: | 184 private: |
| 176 friend class GrGLFullProgramBuilder; | 185 friend class GrGLFullProgramBuilder; |
| 177 | 186 |
| 178 GrGLVertexProgramEffects(int reserveCount, bool explicitLocalCoords) | 187 GrGLVertexProgramEffects(int reserveCount, bool explicitLocalCoords) |
| 179 : INHERITED(reserveCount) | 188 : INHERITED(reserveCount) |
| 180 , fTransforms(reserveCount) | 189 , fTransforms(reserveCount) |
| 181 , fHasExplicitLocalCoords(explicitLocalCoords) { | 190 , fHasExplicitLocalCoords(explicitLocalCoords) { |
| 182 } | 191 } |
| 183 /** | 192 /** |
| 184 * This method is meant to only be called during the construction phase. | 193 * This method is meant to only be called during the construction phase. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 */ | 346 */ |
| 338 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } | 347 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } |
| 339 private: | 348 private: |
| 340 GrGLFragmentOnlyProgramBuilder* fBuilder; | 349 GrGLFragmentOnlyProgramBuilder* fBuilder; |
| 341 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; | 350 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; |
| 342 typedef GrGLProgramEffectsBuilder INHERITED; | 351 typedef GrGLProgramEffectsBuilder INHERITED; |
| 343 }; | 352 }; |
| 344 | 353 |
| 345 | 354 |
| 346 #endif | 355 #endif |
| OLD | NEW |