Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: src/gpu/gl/GrGLProgramEffects.cpp

Issue 379113004: Makes GrGLProgramDesc's key store the lengths as well as offsets of the effect keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: fix typo Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLProgramEffects.cpp
diff --git a/src/gpu/gl/GrGLProgramEffects.cpp b/src/gpu/gl/GrGLProgramEffects.cpp
index 65d14fde116dc65f29f20ab426048583aa326ba1..436ff89e9822f8b7d6ae4a0d41687cf73600ea5d 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();
+
robertphillips 2014/07/11 17:24:58 Currently ?
bsalomon 2014/07/11 17:52:56 Done.
+ // Currenlty 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();

Powered by Google App Engine
This is Rietveld 408576698