Mesa (master): r300g: fix 24-bit depth texturing

Marek Olšák mareko at kemper.freedesktop.org
Sun Jun 6 19:30:02 PDT 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon Jun  7 04:10:49 2010 +0200

r300g: fix 24-bit depth texturing

This is a secret texture format, do not tell anybody.
And it looks like we can read stencil in the shader too.

---

 src/gallium/drivers/r300/r300_reg.h     |    1 +
 src/gallium/drivers/r300/r300_texture.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index 675a931..c4fa19a 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -1575,6 +1575,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R500_TX_FORMAT_Y10X10                0x3
 #       define R500_TX_FORMAT_W10Z10Y10X10          0x4
 #       define R500_TX_FORMAT_ATI1N                 0x5
+#       define R500_TX_FORMAT_Y8X24                 0x6
 
 
 #       define R300_TX_FORMAT_SIGNED_W             (1 << 5)
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 4823755..5a013e2 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -139,7 +139,7 @@ uint32_t r300_translate_texformat(enum pipe_format format,
                     return R300_TX_FORMAT_X16;
                 case PIPE_FORMAT_X8Z24_UNORM:
                 case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
-                    return R300_TX_FORMAT_W24_FP;
+                    return R500_TX_FORMAT_Y8X24;
                 default:
                     return ~0; /* Unsupported. */
             }
@@ -339,6 +339,8 @@ uint32_t r500_tx_format_msb_bit(enum pipe_format format)
     switch (format) {
         case PIPE_FORMAT_RGTC1_UNORM:
         case PIPE_FORMAT_RGTC1_SNORM:
+        case PIPE_FORMAT_X8Z24_UNORM:
+        case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
             return R500_TXFORMAT_MSB;
         default:
             return 0;



More information about the mesa-commit mailing list