diff options
author | Xiang, Haihao <[email protected]> | 2008-08-05 11:28:54 +0800 |
---|---|---|
committer | Xiang, Haihao <[email protected]> | 2008-08-05 11:34:26 +0800 |
commit | 8e8019b49ab137403ba92aef3e286f4e27049ad5 (patch) | |
tree | 2bd99df8f04c891a4da08c8fd971fb95598eae51 | |
parent | a3024caff1c790cf9f24476926aa62198f1e7b53 (diff) |
dri: Fix write/read depth buffer issue under 16bpp mode. See bug #16646
-rw-r--r-- | src/mesa/drivers/dri/common/depthtmp.h | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_span.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810span.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_span.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_span.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mgaspan.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_span.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_span.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_span.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_span.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/s3v/s3v_span.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagespan.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/sis/sis_span.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_span.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddspan.c | 4 |
15 files changed, 67 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/common/depthtmp.h b/src/mesa/drivers/dri/common/depthtmp.h index 55199abf6a3..fd2dab3b422 100644 --- a/src/mesa/drivers/dri/common/depthtmp.h +++ b/src/mesa/drivers/dri/common/depthtmp.h @@ -29,7 +29,7 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx, { HW_WRITE_LOCK() { - const GLuint *depth = (const GLuint *) values; + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; GLint x1; GLint n1; LOCAL_DEPTH_VARS; @@ -134,7 +134,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx, { HW_WRITE_LOCK() { - const GLuint *depth = (const GLuint *) values; + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; GLuint i; LOCAL_DEPTH_VARS; @@ -180,7 +180,7 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx, { HW_READ_LOCK() { - GLuint *depth = (GLuint *) values; + VALUE_TYPE *depth = (VALUE_TYPE *) values; GLint x1, n1; LOCAL_DEPTH_VARS; @@ -215,7 +215,7 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, { HW_READ_LOCK() { - GLuint *depth = (GLuint *) values; + VALUE_TYPE *depth = (VALUE_TYPE *) values; GLuint i; LOCAL_DEPTH_VARS; @@ -267,3 +267,4 @@ static void TAG(InitDepthPointers)(struct gl_renderbuffer *rb) #undef READ_DEPTH #endif #undef TAG +#undef VALUE_TYPE diff --git a/src/mesa/drivers/dri/gamma/gamma_span.c b/src/mesa/drivers/dri/gamma/gamma_span.c index f62bea9b66d..933f62c96c7 100644 --- a/src/mesa/drivers/dri/gamma/gamma_span.c +++ b/src/mesa/drivers/dri/gamma/gamma_span.c @@ -112,6 +112,8 @@ do { \ /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d; @@ -125,6 +127,8 @@ do { \ #if 0 /* Unused */ /* 32 bit depthbuffer functions. */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) \ *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d; @@ -138,6 +142,8 @@ do { \ /* 24/8 bit interleaved depth/stencil functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \ tmp &= 0xff; \ diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index 2112800eebc..59511de973b 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -67,6 +67,8 @@ do { \ /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index df4f5927a0f..742b1b87350 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -99,7 +99,6 @@ #define GET_PTR(X,Y) (buf + ((Y) * irb->pfPitch + (X)) * 4) #include "spantmp2.h" - #define LOCAL_DEPTH_VARS \ struct intel_context *intel = intel_context(ctx); \ struct intel_renderbuffer *irb = intel_renderbuffer(rb); \ @@ -115,6 +114,8 @@ /** ** 16-bit depthbuffer functions. **/ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ ((GLushort *)buf)[(_x) + (_y) * pitch] = d; @@ -132,6 +133,8 @@ ** The wrappers in main/depthstencil.c are used to extract the depth ** and stencil values. **/ +#define VALUE_TYPE GLuint + /* Change ZZZS -> SZZZ */ #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = ((d) >> 8) | ((d) << 24); \ diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c index 3830a28165b..aa8c72513ba 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.c +++ b/src/mesa/drivers/dri/mach64/mach64_span.c @@ -117,6 +117,8 @@ /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2) = d; diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 05dcbb85263..7ac59661acd 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -107,6 +107,8 @@ /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d; @@ -121,6 +123,8 @@ /* 32 bit depthbuffer functions. */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) \ *(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d; @@ -134,6 +138,8 @@ /* 24/8 bit interleaved depth/stencil functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \ tmp &= 0xff; \ diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c index 85798c16013..9b73886816f 100644 --- a/src/mesa/drivers/dri/r128/r128_span.c +++ b/src/mesa/drivers/dri/r128/r128_span.c @@ -131,6 +131,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 16-bit depth buffer functions */ +#define VALUE_TYPE GLushort #define WRITE_DEPTH_SPAN() \ do { \ @@ -207,6 +208,8 @@ do { \ /* 24-bit depth, 8-bit stencil buffer functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH_SPAN() \ do { \ GLuint buf[n]; \ diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c index ff2eb011225..3d7a0002180 100644 --- a/src/mesa/drivers/dri/r200/r200_span.c +++ b/src/mesa/drivers/dri/r200/r200_span.c @@ -172,6 +172,7 @@ r200_mba_z16( driRenderbuffer *drb, GLint x, GLint y ) /* 16-bit depth buffer functions */ +#define VALUE_TYPE GLushort #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + r200_mba_z16( drb, _x + xo, _y + yo )) = d; @@ -185,6 +186,7 @@ r200_mba_z16( driRenderbuffer *drb, GLint x, GLint y ) /* 24 bit depth, 8 bit stencil depthbuffer functions */ +#define VALUE_TYPE GLuint #define WRITE_DEPTH( _x, _y, d ) \ do { \ diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c index f1bc56ea6a4..3616d8b14de 100644 --- a/src/mesa/drivers/dri/r300/radeon_span.c +++ b/src/mesa/drivers/dri/r300/radeon_span.c @@ -172,6 +172,8 @@ radeon_mba_z16(const driRenderbuffer * drb, GLint x, GLint y) /* 16-bit depth buffer functions */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + radeon_mba_z16( drb, _x + xo, _y + yo )) = d; @@ -186,6 +188,8 @@ radeon_mba_z16(const driRenderbuffer * drb, GLint x, GLint y) * Careful: It looks like the R300 uses ZZZS byte order while the R200 * uses SZZZ for 24 bit depth, 8 bit stencil mode. */ +#define VALUE_TYPE GLuint + #ifdef COMPILE_R300 #define WRITE_DEPTH( _x, _y, d ) \ do { \ diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 732a85ecf0b..e7ab3677b36 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -173,6 +173,8 @@ radeon_mba_z16(const driRenderbuffer * drb, GLint x, GLint y) /* 16-bit depth buffer functions */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + radeon_mba_z16( drb, _x + xo, _y + yo )) = d; @@ -187,6 +189,8 @@ radeon_mba_z16(const driRenderbuffer * drb, GLint x, GLint y) * Careful: It looks like the R300 uses ZZZS byte order while the R200 * uses SZZZ for 24 bit depth, 8 bit stencil mode. */ +#define VALUE_TYPE GLuint + #ifdef COMPILE_R300 #define WRITE_DEPTH( _x, _y, d ) \ do { \ diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c index de78f9f6b1b..f9f7c0d1eee 100644 --- a/src/mesa/drivers/dri/s3v/s3v_span.c +++ b/src/mesa/drivers/dri/s3v/s3v_span.c @@ -128,6 +128,8 @@ do { \ /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + _x*2 + _y*dPriv->w*2) = d @@ -143,6 +145,8 @@ do { \ /* 32 bit depthbuffer functions. */ #if 0 +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) \ *(GLuint *)(buf + _x*4 + _y*pitch) = d; @@ -157,6 +161,8 @@ do { \ /* 24/8 bit interleaved depth/stencil functions */ #if 0 +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \ tmp &= 0xff; \ diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 61ab9e6d64a..00fd1259fd6 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -93,6 +93,8 @@ /* 16 bit integer depthbuffer functions * Depth range is reversed. See also savageCalcViewport. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) = 0xFFFF - d @@ -107,6 +109,8 @@ /* 16 bit float depthbuffer functions */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + ((_x)<<1) + (_y)*pitch) = \ savageEncodeFloat16( 1.0 - (GLfloat)d/65535.0 ) @@ -125,6 +129,8 @@ /* 8-bit stencil /24-bit integer depth depthbuffer functions. * Depth range is reversed. See also savageCalcViewport. */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) do { \ GLuint tmp = *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch); \ tmp &= 0xFF000000; \ @@ -143,6 +149,8 @@ /* 24 bit float depthbuffer functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) do { \ GLuint tmp = *(GLuint *)(buf + ((_x)<<2) + (_y)*pitch); \ tmp &= 0xFF000000; \ diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index ea6db6781d4..7f205f3ca50 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -85,6 +85,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 16 bit depthbuffer functions. */ +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + (_x)*2 + (_y)*srb->pitch) = d; @@ -97,6 +99,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 32 bit depthbuffer functions. */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) \ *(GLuint *)(buf + (_x)*4 + (_y)*srb->pitch) = d; @@ -109,6 +113,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 8/24 bit interleaved depth/stencil functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*srb->pitch); \ tmp &= 0xff000000; \ diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index 3a16dadd238..15e29c52cd9 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -86,6 +86,7 @@ #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS +#define VALUE_TYPE GLushort #define WRITE_DEPTH(_x, _y, d) \ *(GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch) = d; @@ -98,6 +99,8 @@ /* 32 bit depthbuffer functions. */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH(_x, _y, d) \ *(GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch) = d; @@ -111,6 +114,8 @@ /* 24/8 bit interleaved depth/stencil functions */ +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) { \ GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch); \ tmp &= 0x000000ff; \ diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index 3ea9f73dd20..d3a58a301c2 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -275,6 +275,8 @@ #undef BYTESPERPIXEL #define BYTESPERPIXEL 2 +#define VALUE_TYPE GLushort + #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d @@ -302,6 +304,8 @@ #undef BYTESPERPIXEL #define BYTESPERPIXEL 4 +#define VALUE_TYPE GLuint + #define WRITE_DEPTH( _x, _y, d ) \ *(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d << 8 |