Allow GrGLEffects to produce variable length keys.
R=robertphillips@google.com, jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/385713005
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 43ef7e76..f20d1db 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -21,7 +21,7 @@
virtual void emitCode(GrGLShaderBuilder*,
const GrDrawEffect&,
- EffectKey,
+ const GrEffectKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -29,7 +29,7 @@
virtual void setData(const GrGLUniformManager& uman, const GrDrawEffect&) SK_OVERRIDE;
- static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
+ static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
private:
int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); }
@@ -57,7 +57,7 @@
void GrGLConvolutionEffect::emitCode(GrGLShaderBuilder* builder,
const GrDrawEffect&,
- EffectKey key,
+ const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -134,16 +134,16 @@
uman.set1fv(fKernelUni, this->width(), conv.kernel());
}
-GrGLEffect::EffectKey GrGLConvolutionEffect::GenKey(const GrDrawEffect& drawEffect,
- const GrGLCaps&) {
+void GrGLConvolutionEffect::GenKey(const GrDrawEffect& drawEffect, const GrGLCaps&,
+ GrEffectKeyBuilder* b) {
const GrConvolutionEffect& conv = drawEffect.castEffect<GrConvolutionEffect>();
- EffectKey key = conv.radius();
+ uint32_t key = conv.radius();
key <<= 2;
if (conv.useBounds()) {
key |= 0x2;
key |= GrConvolutionEffect::kY_Direction == conv.direction() ? 0x1 : 0x0;
}
- return key;
+ b->add32(key);
}
///////////////////////////////////////////////////////////////////////////////