From e216b6ca0fd968e42b612f0a0508f798756d0890 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 18 Mar 2013 13:27:47 -0400 Subject: [PATCH] background: Fix the desaturate effect when on its own We need to make sure cogl_texel is set to something, otherwise we'll have junk. https://bugzilla.gnome.org/show_bug.cgi?id=696087 --- src/compositor/meta-background.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index fd2d1d271..7876d594c 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -63,6 +63,11 @@ " return vec3(mix(color.rgb, gray, 1.0 - saturation));\n" \ "}\n" \ +/* Used when we don't have a blur, as the texel is going to be junk + * unless we set something to it. */ +#define DESATURATE_PRELUDE \ +"cogl_texel = texture2D(cogl_sampler, cogl_tex_coord.st);\n" + #define DESATURATE_CODE \ "cogl_texel.rgb = desaturate(cogl_texel.rgb);\n" @@ -621,7 +626,7 @@ add_texture_lookup_shader (MetaBackground *self) else if (priv->effects & META_BACKGROUND_EFFECTS_BLUR) code = BLUR_CODE; else if (priv->effects & META_BACKGROUND_EFFECTS_DESATURATE) - code = DESATURATE_CODE; + code = DESATURATE_PRELUDE "\n" DESATURATE_CODE; else return;