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 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 const GrGLCaps& caps) { | 24 const GrGLCaps& caps) { |
25 EffectKey key = 0; | 25 EffectKey key = 0; |
26 for (int index = 0; index < (*effect)->numTextures(); ++index) { | 26 for (int index = 0; index < (*effect)->numTextures(); ++index) { |
27 const GrTextureAccess& access = (*effect)->textureAccess(index); | 27 const GrTextureAccess& access = (*effect)->textureAccess(index); |
28 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) <
< index; | 28 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) <
< index; |
29 GrAssert(0 == (value & key)); // keys for each access ought not to overl
ap | 29 GrAssert(0 == (value & key)); // keys for each access ought not to overl
ap |
30 key |= value; | 30 key |= value; |
31 } | 31 } |
32 return key; | 32 return key; |
33 } | 33 } |
| 34 |
| 35 GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrEffectStage& stage) { |
| 36 EffectKey key = 0; |
| 37 |
| 38 int numAttributes = stage.getVertexAttribIndexCount(); |
| 39 GrAssert(numAttributes <= 2); |
| 40 const int* attributeIndices = stage.getVertexAttribIndices(); |
| 41 for (int index = 0; index < numAttributes; ++index) { |
| 42 EffectKey value = attributeIndices[index] << 2*index; |
| 43 GrAssert(0 == (value & key)); // keys for each attribute ought not to ov
erlap |
| 44 key |= value; |
| 45 } |
| 46 |
| 47 return key; |
| 48 } |
OLD | NEW |