r300: fix depth textures
authorMaciej Cencora <m.cencora@gmail.com>
Fri, 11 Dec 2009 22:56:47 +0000 (23:56 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Fri, 11 Dec 2009 22:56:47 +0000 (23:56 +0100)
src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/radeon/radeon_texture.c

index e6f2c0c1a7b874cf6cb936b0cac7bb1e0af0e150..bbe8b1e95f9c998be2f5e0b7cb0231cbd7982483 100644 (file)
@@ -138,9 +138,9 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj)
                        R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16),
                },
                {
-                       R300_EASY_TX_FORMAT(X, X, X, ONE, X24_Y8),
-                       R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8),
-                       R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X24_Y8),
+                       R300_EASY_TX_FORMAT(Y, Y, Y, ONE, X24_Y8),
+                       R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8),
+                       R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, Y, X24_Y8),
                },
                {
                        R300_EASY_TX_FORMAT(X, X, X, ONE, X32),
index 28690325d1259bffbab4f8d51ca9be6a31cf44a5..03178116c1ab0d6bfd23ab7308b970c5e8947fb0 100644 (file)
@@ -472,6 +472,19 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
        case GL_RGBA32F_ARB:
                return MESA_FORMAT_RGBA_FLOAT32;
 
+#ifdef RADEON_R300
+       case GL_DEPTH_COMPONENT:
+       case GL_DEPTH_COMPONENT16:
+               return MESA_FORMAT_Z16;
+       case GL_DEPTH_COMPONENT24:
+       case GL_DEPTH_COMPONENT32:
+       case GL_DEPTH_STENCIL_EXT:
+       case GL_DEPTH24_STENCIL8_EXT:
+               if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_RV515)
+                       return MESA_FORMAT_S8_Z24;
+               else
+                       return MESA_FORMAT_Z16;
+#else
        case GL_DEPTH_COMPONENT:
        case GL_DEPTH_COMPONENT16:
        case GL_DEPTH_COMPONENT24:
@@ -479,6 +492,7 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
        case GL_DEPTH_STENCIL_EXT:
        case GL_DEPTH24_STENCIL8_EXT:
                return MESA_FORMAT_S8_Z24;
+#endif
 
        /* EXT_texture_sRGB */
        case GL_SRGB: