| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrGLSL.h" | 8 #include "GrGLSL.h" |
| 9 #include "GrGLEffect.h" | 9 #include "GrGLEffect.h" |
| 10 #include "GrDrawEffect.h" |
| 10 | 11 |
| 11 GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory) | 12 GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory) |
| 12 : fFactory(factory) { | 13 : fFactory(factory) { |
| 13 } | 14 } |
| 14 | 15 |
| 15 GrGLEffect::~GrGLEffect() { | 16 GrGLEffect::~GrGLEffect() { |
| 16 } | 17 } |
| 17 | 18 |
| 18 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
| 19 | 20 |
| 20 void GrGLEffect::setData(const GrGLUniformManager&, const GrEffectStage&) { | 21 void GrGLEffect::setData(const GrGLUniformManager&, const GrDrawEffect&) { |
| 21 } | 22 } |
| 22 | 23 |
| 23 GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffectRef* effect, | 24 GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrDrawEffect& drawEffect, |
| 24 const GrGLCaps& caps) { | 25 const GrGLCaps& caps) { |
| 25 EffectKey key = 0; | 26 EffectKey key = 0; |
| 26 for (int index = 0; index < (*effect)->numTextures(); ++index) { | 27 int numTextures = (*drawEffect.effect())->numTextures(); |
| 27 const GrTextureAccess& access = (*effect)->textureAccess(index); | 28 for (int index = 0; index < numTextures; ++index) { |
| 29 const GrTextureAccess& access = (*drawEffect.effect())->textureAccess(in
dex); |
| 28 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) <
< index; | 30 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) <
< index; |
| 29 GrAssert(0 == (value & key)); // keys for each access ought not to overl
ap | 31 GrAssert(0 == (value & key)); // keys for each access ought not to overl
ap |
| 30 key |= value; | 32 key |= value; |
| 31 } | 33 } |
| 32 return key; | 34 return key; |
| 33 } | 35 } |
| 34 | 36 |
| 35 GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrEffectStage& stage) { | 37 GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrDrawEffect& drawEffect) { |
| 36 EffectKey key = 0; | 38 EffectKey key = 0; |
| 37 | 39 |
| 38 int numAttributes = stage.getVertexAttribIndexCount(); | 40 int numAttributes = drawEffect.getVertexAttribIndexCount(); |
| 39 GrAssert(numAttributes <= 2); | 41 GrAssert(numAttributes <= 2); |
| 40 const int* attributeIndices = stage.getVertexAttribIndices(); | 42 const int* attributeIndices = drawEffect.getVertexAttribIndices(); |
| 41 for (int index = 0; index < numAttributes; ++index) { | 43 for (int index = 0; index < numAttributes; ++index) { |
| 42 EffectKey value = attributeIndices[index] << 3*index; | 44 EffectKey value = attributeIndices[index] << 3*index; |
| 43 GrAssert(0 == (value & key)); // keys for each attribute ought not to ov
erlap | 45 GrAssert(0 == (value & key)); // keys for each attribute ought not to ov
erlap |
| 44 key |= value; | 46 key |= value; |
| 45 } | 47 } |
| 46 | 48 |
| 47 return key; | 49 return key; |
| 48 } | 50 } |
| OLD | NEW |