i915: Correct and make use of the defines for 32-bit depth texture modes.
authorEric Anholt <eric@anholt.net>
Thu, 29 Oct 2009 20:35:03 +0000 (13:35 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 29 Oct 2009 21:56:52 +0000 (14:56 -0700)
Previously, S8_Z24 depth textures would always be treated as intensity.
Fixes piglit depth-tex-modes.

src/mesa/drivers/dri/i915/i915_reg.h
src/mesa/drivers/dri/i915/i915_texstate.c

index b5fa7fddb9636f186ce715e57b45db6f4c181219..7f31ff674f24c478357b38ba807e1de1027d3a79 100644 (file)
 #define    MT_32BIT_AWVU2101010                   (0xA<<3)
 #define    MT_32BIT_GR1616                (0xB<<3)
 #define    MT_32BIT_VU1616                (0xC<<3)
-#define    MT_32BIT_xI824                 (0xD<<3)
-#define    MT_32BIT_xA824                 (0xE<<3)
-#define    MT_32BIT_xL824                 (0xF<<3)
+#define    MT_32BIT_x8I24                 (0xD<<3)
+#define    MT_32BIT_x8L24                 (0xE<<3)
+#define    MT_32BIT_x8A24                 (0xF<<3)
 #define    MT_422_YCRCB_SWAPY             (0<<3)       /* SURFACE_422 */
 #define    MT_422_YCRCB_NORMAL            (1<<3)
 #define    MT_422_YCRCB_SWAPUV            (2<<3)
index 1397f04a59e0d2e72f963f75bbff9a61d36bcecd..0c29c558ec741c9c9803fa615d1e5de365d2b519 100644 (file)
@@ -82,7 +82,12 @@ translate_texture_format(gl_format mesa_format, GLuint internal_format,
    case MESA_FORMAT_RGBA_DXT5:
       return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
    case MESA_FORMAT_S8_Z24:
-      return (MAPSURF_32BIT | MT_32BIT_xI824);
+      if (DepthMode == GL_ALPHA)
+        return (MAPSURF_32BIT | MT_32BIT_x8A24);
+      else if (DepthMode == GL_INTENSITY)
+        return (MAPSURF_32BIT | MT_32BIT_x8I24);
+      else
+        return (MAPSURF_32BIT | MT_32BIT_x8L24);
    default:
       fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format);
       abort();