From e9d3c0c27aa802166b75634079e47920784f9b26 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 4 Dec 2015 06:18:43 +1000 Subject: [PATCH] renderer: fix alpha swizzle detection We need to check if any swizzles point to alpha and fix them up, not just the alpha one. This fixes misrendering in gnome-shell. --- src/vrend_renderer.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index d835317..e584a36 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1266,14 +1266,23 @@ int vrend_create_sampler_view(struct vrend_context *ctx, !util_format_is_srgb(view->format)) view->srgb_decode = GL_SKIP_DECODE_EXT; } - if (util_format_has_alpha(format) || util_format_is_depth_or_stencil(format)) - view->gl_swizzle_a = to_gl_swizzle(view->swizzle_a); - else - view->gl_swizzle_a = GL_ONE; + + view->gl_swizzle_a = to_gl_swizzle(view->swizzle_a); view->gl_swizzle_r = to_gl_swizzle(view->swizzle_r); view->gl_swizzle_g = to_gl_swizzle(view->swizzle_g); view->gl_swizzle_b = to_gl_swizzle(view->swizzle_b); + if (!(util_format_has_alpha(format) || util_format_is_depth_or_stencil(format))) { + if (view->gl_swizzle_a == GL_ALPHA) + view->gl_swizzle_a = GL_ONE; + if (view->gl_swizzle_r == GL_ALPHA) + view->gl_swizzle_r = GL_ONE; + if (view->gl_swizzle_g == GL_ALPHA) + view->gl_swizzle_g = GL_ONE; + if (view->gl_swizzle_b == GL_ALPHA) + view->gl_swizzle_b = GL_ONE; + } + if (tex_conv_table[format].flags & VREND_BIND_NEED_SWIZZLE) { view->gl_swizzle_r = to_gl_swizzle(tex_conv_table[format].swizzle[0]); view->gl_swizzle_g = to_gl_swizzle(tex_conv_table[format].swizzle[1]);