r300g: Fix EXT_packed_depth_stencil functionality.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 27 Jun 2009 17:57:03 +0000 (10:57 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 27 Jun 2009 19:07:59 +0000 (12:07 -0700)
Allow Z24S8 to be a true texture.

src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_texture.h

index 6817d7163d61d55ce235b6f01220f27e3a2927eb..42a7009481acbe1cea1769fd7be7b5bfae7dff1e 100644 (file)
@@ -214,10 +214,14 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage,
 
         /* Z buffer */
         case PIPE_FORMAT_Z16_UNORM:
-        /* Z buffer with stencil */
-        case PIPE_FORMAT_Z24S8_UNORM:
             return usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
 
+        /* Z buffer with stencil or texture */
+        case PIPE_FORMAT_Z24S8_UNORM:
+            return usage &
+                (PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
+                 PIPE_TEXTURE_USAGE_SAMPLER);
+
         /* Definitely unsupported formats. */
         /* Non-usable Z buffer/stencil formats. */
         case PIPE_FORMAT_Z24X8_UNORM:
index 28157de57bf5df433c0a82f8a69b141badbb50ba..5511cca48cb609cf150ba9d98e5e36e471a2ce05 100644 (file)
@@ -55,10 +55,14 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
         /* DXT5 */
         case PIPE_FORMAT_DXT5_RGBA:
             return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5);
+        /* W24_FP */
+        case PIPE_FORMAT_Z24S8_UNORM:
+            return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP);
         default:
             debug_printf("r300: Implementation error: "
                 "Got unsupported texture format %s in %s\n",
                 pf_name(format), __FUNCTION__);
+            assert(0);
             break;
     }
     return 0;