| 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 #include "GrGLProgramEffects.h" | 8 #include "GrGLProgramEffects.h" |
| 9 #include "GrDrawEffect.h" | 9 #include "GrDrawEffect.h" |
| 10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 static_cast<GrGLTexture*>(textureAccess.getTexture())); | 256 static_cast<GrGLTexture*>(textureAccess.getTexture())); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 //////////////////////////////////////////////////////////////////////////////// | 260 //////////////////////////////////////////////////////////////////////////////// |
| 261 | 261 |
| 262 void GrGLVertexProgramEffects::emitEffect(GrGLFullShaderBuilder* builder, | 262 void GrGLVertexProgramEffects::emitEffect(GrGLFullShaderBuilder* builder, |
| 263 const GrEffectStage& stage, | 263 const GrEffectStage& stage, |
| 264 EffectKey key, | 264 EffectKey key, |
| 265 const char* outColor, | 265 const char* outColor, |
| 266 const char* inColor, | 266 const GrGLSLExpr4& inColor, |
| 267 int stageIndex) { | 267 int stageIndex) { |
| 268 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords); | 268 GrDrawEffect drawEffect(stage, fHasExplicitLocalCoords); |
| 269 const GrEffectRef& effect = *stage.getEffect(); | 269 const GrEffectRef& effect = *stage.getEffect(); |
| 270 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); | 270 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); |
| 271 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); | 271 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); |
| 272 | 272 |
| 273 this->emitAttributes(builder, stage); | 273 this->emitAttributes(builder, stage); |
| 274 this->emitTransforms(builder, effect, key, &coords); | 274 this->emitTransforms(builder, effect, key, &coords); |
| 275 this->emitSamplers(builder, effect, &samplers); | 275 this->emitSamplers(builder, effect, &samplers); |
| 276 | 276 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullShaderB
uilder* builder, | 454 GrGLVertexProgramEffectsBuilder::GrGLVertexProgramEffectsBuilder(GrGLFullShaderB
uilder* builder, |
| 455 int reserveCoun
t) | 455 int reserveCoun
t) |
| 456 : fBuilder(builder) | 456 : fBuilder(builder) |
| 457 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects, | 457 , fProgramEffects(SkNEW_ARGS(GrGLVertexProgramEffects, |
| 458 (reserveCount, fBuilder->hasExplicitLocalCoords
()))) { | 458 (reserveCount, fBuilder->hasExplicitLocalCoords
()))) { |
| 459 } | 459 } |
| 460 | 460 |
| 461 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 461 void GrGLVertexProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
| 462 GrGLProgramEffects::EffectKey k
ey, | 462 GrGLProgramEffects::EffectKey k
ey, |
| 463 const char* outColor, | 463 const char* outColor, |
| 464 const char* inColor, | 464 const GrGLSLExpr4& inColor, |
| 465 int stageIndex) { | 465 int stageIndex) { |
| 466 SkASSERT(NULL != fProgramEffects.get()); | 466 SkASSERT(NULL != fProgramEffects.get()); |
| 467 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 467 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
| 468 } | 468 } |
| 469 | 469 |
| 470 //////////////////////////////////////////////////////////////////////////////// | 470 //////////////////////////////////////////////////////////////////////////////// |
| 471 | 471 |
| 472 void GrGLTexGenProgramEffects::emitEffect(GrGLFragmentOnlyShaderBuilder* builder
, | 472 void GrGLTexGenProgramEffects::emitEffect(GrGLFragmentOnlyShaderBuilder* builder
, |
| 473 const GrEffectStage& stage, | 473 const GrEffectStage& stage, |
| 474 EffectKey key, | 474 EffectKey key, |
| 475 const char* outColor, | 475 const char* outColor, |
| 476 const char* inColor, | 476 const GrGLSLExpr4& inColor, |
| 477 int stageIndex) { | 477 int stageIndex) { |
| 478 GrDrawEffect drawEffect(stage, false); | 478 GrDrawEffect drawEffect(stage, false); |
| 479 const GrEffectRef& effect = *stage.getEffect(); | 479 const GrEffectRef& effect = *stage.getEffect(); |
| 480 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); | 480 SkSTArray<2, TransformedCoords> coords(effect->numTransforms()); |
| 481 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); | 481 SkSTArray<4, TextureSampler> samplers(effect->numTextures()); |
| 482 | 482 |
| 483 SkASSERT(0 == stage.getVertexAttribIndexCount()); | 483 SkASSERT(0 == stage.getVertexAttribIndexCount()); |
| 484 this->setupTexGen(builder, effect, key, &coords); | 484 this->setupTexGen(builder, effect, key, &coords); |
| 485 this->emitSamplers(builder, effect, &samplers); | 485 this->emitSamplers(builder, effect, &samplers); |
| 486 | 486 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 GrGLTexGenProgramEffectsBuilder::GrGLTexGenProgramEffectsBuilder( | 572 GrGLTexGenProgramEffectsBuilder::GrGLTexGenProgramEffectsBuilder( |
| 573 GrGLFragmentOnlyShaderBuilder* builder, | 573 GrGLFragmentOnlyShaderBuilder* builder, |
| 574 int reserveCount) | 574 int reserveCount) |
| 575 : fBuilder(builder) | 575 : fBuilder(builder) |
| 576 , fProgramEffects(SkNEW_ARGS(GrGLTexGenProgramEffects, (reserveCount))) { | 576 , fProgramEffects(SkNEW_ARGS(GrGLTexGenProgramEffects, (reserveCount))) { |
| 577 } | 577 } |
| 578 | 578 |
| 579 void GrGLTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, | 579 void GrGLTexGenProgramEffectsBuilder::emitEffect(const GrEffectStage& stage, |
| 580 GrGLProgramEffects::EffectKey k
ey, | 580 GrGLProgramEffects::EffectKey k
ey, |
| 581 const char* outColor, | 581 const char* outColor, |
| 582 const char* inColor, | 582 const GrGLSLExpr4& inColor, |
| 583 int stageIndex) { | 583 int stageIndex) { |
| 584 SkASSERT(NULL != fProgramEffects.get()); | 584 SkASSERT(NULL != fProgramEffects.get()); |
| 585 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); | 585 fProgramEffects->emitEffect(fBuilder, stage, key, outColor, inColor, stageIn
dex); |
| 586 } | 586 } |
| OLD | NEW |