Mesa (master): i965: Explicitely handle swizzles for MESA_FORMAT_R_SRGB8

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 28 09:14:49 UTC 2018


Module: Mesa
Branch: master
Commit: d8bb88d0b4d6d58c854ded1d5a6d2bc5e615902e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8bb88d0b4d6d58c854ded1d5a6d2bc5e615902e

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Thu Nov 22 19:00:02 2018 +0100

i965: Explicitely handle swizzles for MESA_FORMAT_R_SRGB8

The format is emulated by using ISL_FORMAT_L8_SRGB, therefore we need to
force swizzles for the GBA channels. However, doing this only based on the
data type GL_RED breaks other formats, therefore, test specifically for the
format.

Fixes: c5363869d4971780401b21bb75083ef2518c12be
  i965: Force zero swizzles for unused components in GL_RED and GL_RG
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 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 ||




More information about the mesa-commit mailing list