Mesa (master): intel: Set the swizzling for depth textures using the GL_RED depth mode.

Eric Anholt anholt at kemper.freedesktop.org
Thu Dec 9 22:42:09 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Dec  9 13:51:21 2010 -0800

intel: Set the swizzling for depth textures using the GL_RED depth mode.

Fixes depth-tex-modes-rg.

---

 src/mesa/drivers/dri/i965/brw_wm.c               |    4 ++++
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index e0aa3fd..656501b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -378,6 +378,10 @@ static void brw_wm_populate_key( struct brw_context *brw,
 	       swizzles[2] = SWIZZLE_ZERO;
 	    } else if (t->DepthMode == GL_LUMINANCE) {
 	       swizzles[3] = SWIZZLE_ONE;
+	    } else if (t->DepthMode == GL_RED) {
+	       swizzles[1] = SWIZZLE_ZERO;
+	       swizzles[2] = SWIZZLE_ZERO;
+	       swizzles[3] = SWIZZLE_ZERO;
 	    }
 	 }
 
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 fb0e34e..ad74404 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -139,6 +139,8 @@ static GLuint translate_tex_format( gl_format mesa_format,
 	  return BRW_SURFACEFORMAT_I16_UNORM;
       else if (depth_mode == GL_ALPHA)
 	  return BRW_SURFACEFORMAT_A16_UNORM;
+      else if (depth_mode == GL_RED)
+	  return BRW_SURFACEFORMAT_R16_UNORM;
       else
 	  return BRW_SURFACEFORMAT_L16_UNORM;
 
@@ -174,6 +176,8 @@ static GLuint translate_tex_format( gl_format mesa_format,
          return BRW_SURFACEFORMAT_I24X8_UNORM;
       else if (depth_mode == GL_ALPHA)
          return BRW_SURFACEFORMAT_A24X8_UNORM;
+      else if (depth_mode == GL_RED)
+         return BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS;
       else
          return BRW_SURFACEFORMAT_L24X8_UNORM;
 




More information about the mesa-commit mailing list