| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void emitAttributes(GrGLFullShaderBuilder*, const GrEffectStage&); | 182 void emitAttributes(GrGLFullShaderBuilder*, const GrEffectStage&); |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * Helper for emitEffect(). Emits code to implement an effect's coord transf
orms in the VS. | 185 * Helper for emitEffect(). Emits code to implement an effect's coord transf
orms in the VS. |
| 186 * Varyings are added as an outputs of the VS and inputs to the FS. The vary
ings may be either a | 186 * Varyings are added as an outputs of the VS and inputs to the FS. The vary
ings may be either a |
| 187 * vec2f or vec3f depending upon whether perspective interpolation is requir
ed or not. The names | 187 * vec2f or vec3f depending upon whether perspective interpolation is requir
ed or not. The names |
| 188 * of the varyings in the VS and FS as well their types are appended to the | 188 * of the varyings in the VS and FS as well their types are appended to the |
| 189 * TransformedCoordsArray* object, which is in turn passed to the effect's e
mitCode() function. | 189 * TransformedCoordsArray* object, which is in turn passed to the effect's e
mitCode() function. |
| 190 */ | 190 */ |
| 191 void emitTransforms(GrGLFullShaderBuilder*, | 191 void emitTransforms(GrGLFullShaderBuilder*, |
| 192 const GrEffect*, | 192 const GrDrawEffect&, |
| 193 EffectKey, | |
| 194 TransformedCoordsArray*); | 193 TransformedCoordsArray*); |
| 195 | 194 |
| 196 /** | 195 /** |
| 197 * Helper for setData(). Sets all the transform matrices for an effect. | 196 * Helper for setData(). Sets all the transform matrices for an effect. |
| 198 */ | 197 */ |
| 199 void setTransformData(const GrGLUniformManager&, const GrDrawEffect&, int ef
fectIdx); | 198 void setTransformData(const GrGLUniformManager&, const GrDrawEffect&, int ef
fectIdx); |
| 200 | 199 |
| 201 struct Transform { | 200 struct Transform { |
| 202 Transform() { fCurrentValue = SkMatrix::InvalidMatrix(); } | 201 Transform() { fCurrentValue = SkMatrix::InvalidMatrix(); } |
| 203 UniformHandle fHandle; | 202 UniformHandle fHandle; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 269 |
| 271 /** | 270 /** |
| 272 * Helper for emitEffect(). Allocates texture units from the builder for eac
h transform in an | 271 * Helper for emitEffect(). Allocates texture units from the builder for eac
h transform in an |
| 273 * effect. The transforms all use adjacent texture units. They either use tw
o or three of the | 272 * effect. The transforms all use adjacent texture units. They either use tw
o or three of the |
| 274 * coordinates at a given texture unit, depending on if they need perspectiv
e interpolation. | 273 * coordinates at a given texture unit, depending on if they need perspectiv
e interpolation. |
| 275 * The expressions to access the transformed coords (i.e. 'vec2(gl_TexCoord[
0])') as well as the | 274 * The expressions to access the transformed coords (i.e. 'vec2(gl_TexCoord[
0])') as well as the |
| 276 * types are appended to the TransformedCoordsArray* object, which is in tur
n passed to the | 275 * types are appended to the TransformedCoordsArray* object, which is in tur
n passed to the |
| 277 * effect's emitCode() function. | 276 * effect's emitCode() function. |
| 278 */ | 277 */ |
| 279 void setupPathTexGen(GrGLFragmentOnlyShaderBuilder*, | 278 void setupPathTexGen(GrGLFragmentOnlyShaderBuilder*, |
| 280 const GrEffect*, | 279 const GrDrawEffect&, |
| 281 EffectKey, | |
| 282 TransformedCoordsArray*); | 280 TransformedCoordsArray*); |
| 283 | 281 |
| 284 /** | 282 /** |
| 285 * Helper for setData(). Sets the PathTexGen state for each transform in an
effect. | 283 * Helper for setData(). Sets the PathTexGen state for each transform in an
effect. |
| 286 */ | 284 */ |
| 287 void setPathTexGenState(GrGpuGL*, const GrDrawEffect&, int effectIdx); | 285 void setPathTexGenState(GrGpuGL*, const GrDrawEffect&, int effectIdx); |
| 288 | 286 |
| 289 struct Transforms { | 287 struct Transforms { |
| 290 Transforms(EffectKey transformKey, int texCoordIndex) | 288 Transforms(EffectKey transformKey, int texCoordIndex) |
| 291 : fTransformKey(transformKey), fTexCoordIndex(texCoordIndex) {} | 289 : fTransformKey(transformKey), fTexCoordIndex(texCoordIndex) {} |
| (...skipping 27 matching lines...) Expand all Loading... |
| 319 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } | 317 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } |
| 320 | 318 |
| 321 private: | 319 private: |
| 322 GrGLFragmentOnlyShaderBuilder* fBuilder; | 320 GrGLFragmentOnlyShaderBuilder* fBuilder; |
| 323 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; | 321 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; |
| 324 | 322 |
| 325 typedef GrGLProgramEffectsBuilder INHERITED; | 323 typedef GrGLProgramEffectsBuilder INHERITED; |
| 326 }; | 324 }; |
| 327 | 325 |
| 328 #endif | 326 #endif |
| OLD | NEW |