[Mesa-dev] [PATCH 3/4] i965: Force zero swizzles for unused components in GL_RED and GL_RG

Gert Wollny gert.wollny at collabora.com
Thu Nov 15 18:01:23 UTC 2018


This makes it possible to use a hardware luminance format as RED format.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 ++++
 1 file changed, 4 insertions(+)

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 8d21cf5fa7..a9307beb36 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -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 ||
-- 
2.19.1



More information about the mesa-dev mailing list