uint32_t GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) { uint32_t key = 0; int numAttributes = drawEffect.getVertexAttribIndexCount(); SkASSERT(numAttributes <= 2); const int* attributeIndices = drawEffect.getVertexAttribIndices(); for (int a = 0; a < numAttributes; ++a) { uint32_t value = attributeIndices[a] << 3 * a; SkASSERT(0 == (value & key)); // keys for each attribute ought not to overlap key |= value; } return key; }
GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrDrawEffect& drawEffect) { EffectKey key = 0; int numAttributes = drawEffect.getVertexAttribIndexCount(); GrAssert(numAttributes <= 2); const int* attributeIndices = drawEffect.getVertexAttribIndices(); for (int index = 0; index < numAttributes; ++index) { EffectKey value = attributeIndices[index] << 3*index; GrAssert(0 == (value & key)); // keys for each attribute ought not to overlap key |= value; } return key; }