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

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

Issue 24853002: Make GPU coord transforms automatic (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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/GrGLEffect.cpp
diff --git a/src/gpu/gl/GrGLEffect.cpp b/src/gpu/gl/GrGLEffect.cpp
index 28be7afb345396188de0569646161590ee36b417..b6183c0b3979fcd7d83cb0ac678f5af54f47bfdf 100644
--- a/src/gpu/gl/GrGLEffect.cpp
+++ b/src/gpu/gl/GrGLEffect.cpp
@@ -7,6 +7,7 @@
#include "GrGLSL.h"
#include "GrGLEffect.h"
+#include "GrCoordTransform.h"
#include "GrDrawEffect.h"
GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory)
@@ -34,6 +35,22 @@ GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrDrawEffect& drawEffect,
return key;
}
+GrGLEffect::EffectKey GrGLEffect::GenTransformKey(const GrDrawEffect& drawEffect) {
+ EffectKey key = 0;
+ int numTransforms = (*drawEffect.effect())->numTransforms();
+ for (int index = 0; index < numTransforms; ++index) {
+ const GrCoordTransform& transform = (*drawEffect.effect())->coordTransform(index);
+ EffectKey value = GrGLCoordTransform::GenKey(transform.getMatrix(),
+ drawEffect,
+ transform.sourceCoords(),
+ transform.reverseY());
+ value <<= index * GrGLCoordTransform::kKeyBits;
+ SkASSERT(0 == (value & key)); // keys for each access ought not to overlap
bsalomon 2013/09/27 20:04:25 keys for each *transform*...
Chris Dalton 2013/09/27 23:33:45 Done.
+ key |= value;
+ }
+ return key;
+}
+
GrGLEffect::EffectKey GrGLEffect::GenAttribKey(const GrDrawEffect& drawEffect) {
EffectKey key = 0;

Powered by Google App Engine
This is Rietveld 408576698