From 879e374c0042cb68b26cc7350d31cec62c2cc342 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 20 Nov 2018 22:34:31 +0100 Subject: [PATCH 1/2] i965: only set swizzle to zero for unsigned byte data type --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 018bae98e8..4daa0e2add 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -420,11 +420,15 @@ brw_get_texture_swizzle(const struct gl_context *ctx, } break; case GL_RED: - swizzles[1] = SWIZZLE_ZERO; + if (img->TexFormat == MESA_FORMAT_R_SRGB8) { + swizzles[0] = SWIZZLE_X; + swizzles[1] = SWIZZLE_ZERO; + swizzles[2] = SWIZZLE_ZERO; + swizzles[3] = SWIZZLE_ONE; + break; + } /* fallthrough */ case GL_RG: - swizzles[2] = SWIZZLE_ZERO; - /* fallthrough */ case GL_RGB: if (_mesa_get_format_bits(img->TexFormat, GL_ALPHA_BITS) > 0 || img->TexFormat == MESA_FORMAT_RGB_DXT1 || -- 2.19.1