Fix span functions for stencil buffer access.
authorNicolai Haehnle <prefect_@gmx.net>
Sat, 14 May 2005 11:43:04 +0000 (11:43 +0000)
committerNicolai Haehnle <prefect_@gmx.net>
Sat, 14 May 2005 11:43:04 +0000 (11:43 +0000)
src/mesa/drivers/dri/r300/radeon_span.c

index 53a321067900582c54570f7a025e0701a8d11c55..0ab6b9b7e0caf9ce0087dfe5e550a3171e138d55 100644 (file)
@@ -286,8 +286,8 @@ do {                                                                        \
 do {                                                                   \
    GLuint offset = radeon_mba_z32( radeon, _x + xo, _y + yo );         \
    GLuint tmp = *(GLuint *)(buf + offset);                             \
-   tmp &= 0x00ffffff;                                                  \
-   tmp |= (((d) & 0xff) << 24);                                                \
+   tmp &= 0xffffff00;                                                  \
+   tmp |= (d) & 0xff;                                                  \
    *(GLuint *)(buf + offset) = tmp;                                    \
 } while (0)
 
@@ -295,8 +295,7 @@ do {                                                                        \
 do {                                                                   \
    GLuint offset = radeon_mba_z32( radeon, _x + xo, _y + yo );         \
    GLuint tmp = *(GLuint *)(buf + offset);                             \
-   tmp &= 0xff000000;                                                  \
-   d = tmp >> 24;                                                      \
+   d = tmp & 0x000000ff;                                               \
 } while (0)
 
 #define TAG(x) radeon##x##_24_8_TILE
@@ -306,19 +305,18 @@ do {                                                                      \
  */
 #define WRITE_STENCIL( _x, _y, d )                                     \
 do {                                                                   \
-   GLuint offset = (_x + xo)*4 + (_y + yo)*pitch;                      \
+   GLuint offset = (_x + xo + (_y + yo)*pitch)*4;                      \
    GLuint tmp = *(GLuint *)(buf + offset);                             \
-   tmp &= 0x00ffffff;                                                  \
-   tmp |= (((d) & 0xff) << 24);                                                \
+   tmp &= 0xffffff00;                                                  \
+   tmp |= (d) & 0xff;                                                  \
    *(GLuint *)(buf + offset) = tmp;                                    \
 } while (0)
 
 #define READ_STENCIL( d, _x, _y )                                      \
 do {                                                                   \
-   GLuint offset = (_x + xo)*4 + (_y + yo)*pitch;                      \
+   GLuint offset = (_x + xo + (_y + yo)*pitch)*4;                      \
    GLuint tmp = *(GLuint *)(buf + offset);                             \
-   tmp &= 0xff000000;                                                  \
-   d = tmp >> 24;                                                      \
+   d = tmp & 0x000000ff;                                               \
 } while (0)
 
 #define TAG(x) radeon##x##_24_8_LINEAR