i965: Force zero swizzles for unused components in GL_RED and GL_RG
authorGert Wollny <gert.wollny@collabora.com>
Thu, 15 Nov 2018 18:01:23 +0000 (19:01 +0100)
committerGert Wollny <gw.fossdev@gmail.com>
Mon, 19 Nov 2018 07:05:44 +0000 (08:05 +0100)
This makes it possible to use a hardware luminance format as RED format.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 3286c222e5b06dd9a4c65664df65e8e4f460a443..018bae98e8804baa97270755c59eef527bd80e8b 100644 (file)
@@ -420,7 +420,11 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
       }
       break;
    case GL_RED:
+      swizzles[1] = SWIZZLE_ZERO;
+      /* 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 ||