Mesa (master): r300: fix reads and writes for MESA_FORMAT_S8Z24 buffer

Brian Paul brianp at kemper.freedesktop.org
Tue Nov 17 20:41:01 UTC 2009


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

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Tue Nov 17 21:27:31 2009 +0100

r300: fix reads and writes for MESA_FORMAT_S8Z24 buffer

Regression was introduced by texformat-rework branch merge.

---

 src/mesa/drivers/dri/radeon/radeon_span.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index b3986ef..37904dc 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -668,7 +668,7 @@ do {									\
 #define WRITE_DEPTH( _x, _y, d )					\
 do {									\
    GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off );		\
-   *_ptr = CPU_TO_LE32(d);                                              \
+   *_ptr = CPU_TO_LE32((((d) & 0xff000000) >> 24) | (((d) & 0x00ffffff) << 8));   \
 } while (0)
 #elif defined(RADEON_R600)
 #define WRITE_DEPTH( _x, _y, d )					\
@@ -701,7 +701,8 @@ do {									\
 #if defined(RADEON_R300)
 #define READ_DEPTH( d, _x, _y )						\
   do { \
-    d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)));	\
+    GLuint tmp = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)));	\
+    d = LE32_TO_CPU(((tmp & 0x000000ff) << 24) | ((tmp & 0xffffff00) >> 8));	\
   }while(0)
 #elif defined(RADEON_R600)
 #define READ_DEPTH( d, _x, _y )						\




More information about the mesa-commit mailing list