mesa: Add MESA_FORMAT_S8_Z24 texture format
authorJakob Bornecrantz <jakob@tungstengraphics.com>
Fri, 6 Jun 2008 14:12:55 +0000 (16:12 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Sun, 8 Jun 2008 14:58:19 +0000 (16:58 +0200)
None of the fetch and store functions implemented.
This atleast stops shadowtex from locking the GPU on
i915 with the linux-dri-x86 target. It most of it looks
okay, with the exception of actually displaying the texture.

src/mesa/main/texformat.c
src/mesa/main/texformat.h
src/mesa/state_tracker/st_format.c

index 88fbd8f07c2daa936080455d2fb8435b90dc7a33..d479bf510ee3ae083cd7314795254a37ed5be9cd 100644 (file)
@@ -1207,6 +1207,41 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
    store_texel_z24_s8                  /* StoreTexel */
 };
 
+const struct gl_texture_format _mesa_texformat_s8_z24 = {
+   MESA_FORMAT_S8_Z24,                 /* MesaFormat */
+   GL_DEPTH_STENCIL_EXT,               /* BaseFormat */
+   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   0,                                  /* RedBits */
+   0,                                  /* GreenBits */
+   0,                                  /* BlueBits */
+   0,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   24,                                 /* DepthBits */
+   8,                                  /* StencilBits */
+   4,                                  /* TexelBytes */
+#if 0
+   _mesa_texstore_s8_z24,              /* StoreTexImageFunc */
+#else
+   _mesa_texstore_z24_s8,              /* StoreTexImageFunc */
+#endif
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+#if 0
+   fetch_texel_1d_f_s8_z24,            /* FetchTexel1Df */
+   fetch_texel_2d_f_s8_z24,            /* FetchTexel2Df */
+   fetch_texel_3d_f_s8_z24,            /* FetchTexel3Df */
+   store_texel_s8_z24                  /* StoreTexel */
+#else
+   fetch_texel_1d_f_z24_s8,            /* FetchTexel1Df */
+   fetch_texel_2d_f_z24_s8,            /* FetchTexel2Df */
+   fetch_texel_3d_f_z24_s8,            /* FetchTexel3Df */
+   store_texel_z24_s8                  /* StoreTexel */
+#endif
+};
+
 const struct gl_texture_format _mesa_texformat_z16 = {
    MESA_FORMAT_Z16,                    /* MesaFormat */
    GL_DEPTH_COMPONENT,                 /* BaseFormat */
index 48f0fe99f27c01cfcfb0835c2a57b48c409a593a..8f4e2feb483b507912217324acb40a66c37cab33 100644 (file)
@@ -84,6 +84,7 @@ enum _format {
    MESA_FORMAT_YCBCR,          /*                     YYYY YYYY UorV UorV */
    MESA_FORMAT_YCBCR_REV,      /*                     UorV UorV YYYY YYYY */
    MESA_FORMAT_Z24_S8,          /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
+   MESA_FORMAT_S8_Z24,          /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
    MESA_FORMAT_Z16,             /*                     ZZZZ ZZZZ ZZZZ ZZZZ */
    MESA_FORMAT_Z32,             /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
    /*@}*/
@@ -209,6 +210,7 @@ extern const struct gl_texture_format _mesa_texformat_l8;
 extern const struct gl_texture_format _mesa_texformat_i8;
 extern const struct gl_texture_format _mesa_texformat_ci8;
 extern const struct gl_texture_format _mesa_texformat_z24_s8;
+extern const struct gl_texture_format _mesa_texformat_s8_z24;
 extern const struct gl_texture_format _mesa_texformat_z16;
 extern const struct gl_texture_format _mesa_texformat_z32;
 /*@}*/
index 17a3cfd5a466357f8d3be741a35843ea60f6729f..1b9325c159df3756d123b7955270180b6d3085f8 100644 (file)
@@ -274,6 +274,8 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat)
       return PIPE_FORMAT_Z32_UNORM;
    case MESA_FORMAT_Z24_S8:
       return PIPE_FORMAT_Z24S8_UNORM;
+   case MESA_FORMAT_S8_Z24:
+      return PIPE_FORMAT_S8Z24_UNORM;
    case MESA_FORMAT_YCBCR:
       return PIPE_FORMAT_YCBCR;
    case MESA_FORMAT_RGB_DXT1:
@@ -559,10 +561,10 @@ translate_gallium_format_to_mesa_format(enum pipe_format format)
       return &_mesa_texformat_z16;
    case PIPE_FORMAT_Z32_UNORM:
       return &_mesa_texformat_z32;
-   case PIPE_FORMAT_S8Z24_UNORM:
-      /* XXX fallthrough OK? */
    case PIPE_FORMAT_Z24S8_UNORM:
       return &_mesa_texformat_z24_s8;
+   case PIPE_FORMAT_S8Z24_UNORM:
+      return &_mesa_texformat_s8_z24;
    case PIPE_FORMAT_YCBCR:
       return &_mesa_texformat_ycbcr;
    case PIPE_FORMAT_YCBCR_REV: