Index: src/gpu/gl/GrGLProgramEffects.cpp |
diff --git a/src/gpu/gl/GrGLProgramEffects.cpp b/src/gpu/gl/GrGLProgramEffects.cpp |
index 65d14fde116dc65f29f20ab426048583aa326ba1..9936aa54ad975897143549bc624a0272ebe25879 100644 |
--- a/src/gpu/gl/GrGLProgramEffects.cpp |
+++ b/src/gpu/gl/GrGLProgramEffects.cpp |
@@ -114,6 +114,27 @@ SkMatrix get_transform_matrix(const GrDrawEffect& drawEffect, int transformIdx) |
//////////////////////////////////////////////////////////////////////////////// |
+bool GrGLProgramEffects::GenEffectMetaKey(const GrDrawEffect& drawEffect, const GrGLCaps& caps, |
+ GrEffectKeyBuilder* b) { |
+ |
+ EffectKey textureKey = GrGLProgramEffects::GenTextureKey(drawEffect, caps); |
+ EffectKey transformKey = GrGLProgramEffects::GenTransformKey(drawEffect); |
+ EffectKey attribKey = GrGLProgramEffects::GenAttribKey(drawEffect); |
+ uint32_t classID = drawEffect.effect()->getFactory().effectClassID(); |
+ |
+ // Currently we allow 16 bits for each of the above portions of the meta-key. Fail if they |
+ // don't fit. |
+ static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); |
+ if ((textureKey | transformKey | attribKey | classID) & kMetaKeyInvalidMask) { |
+ return false; |
+ } |
+ |
+ uint32_t* key = b->add32n(2); |
+ key[0] = (textureKey << 16 | transformKey); |
+ key[1] = (classID << 16 | attribKey); |
+ return true; |
+} |
+ |
EffectKey GrGLProgramEffects::GenAttribKey(const GrDrawEffect& drawEffect) { |
EffectKey key = 0; |
int numAttributes = drawEffect.getVertexAttribIndexCount(); |