diff options
author | Brian <[email protected]> | 2007-08-01 13:04:58 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-01 13:04:58 -0600 |
commit | 5fd46065915d3958569ebb590104b69886352157 (patch) | |
tree | 1bd791b1e97049458b9f6b267fad8cfa81471f73 /src/mesa/pipe | |
parent | fb206809ba2a131fd9034e10a00592f2d0d81fce (diff) |
s/Z24_S8/S8_Z24/ (stencil is in the high byte)
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/p_defines.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_clear.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_quad_depth_test.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_surface.c | 61 |
4 files changed, 35 insertions, 32 deletions
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 58f01758e32..c92895342e6 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -145,7 +145,7 @@ #define PIPE_FORMAT_U_Z16 10 /**< ushort Z/depth */ #define PIPE_FORMAT_U_Z32 11 /**< uint Z/depth */ #define PIPE_FORMAT_F_Z32 12 /**< float Z/depth */ -#define PIPE_FORMAT_Z24_S8 13 /**< 24-bit Z + 8-bit stencil */ +#define PIPE_FORMAT_S8_Z24 13 /**< 8-bit stencil + 24-bit Z */ #define PIPE_FORMAT_U_S8 14 /**< 8-bit stencil */ diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index 40b1156715a..6266d124be0 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -105,7 +105,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, case PIPE_FORMAT_U_Z32: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff); break; - case PIPE_FORMAT_Z24_S8: + case PIPE_FORMAT_S8_Z24: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); break; default: diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c index a26bd51d846..3a8df33e674 100644 --- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c +++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c @@ -59,7 +59,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) */ if (sps->surface.format == PIPE_FORMAT_U_Z16) scale = 65535.0; - else if (sps->surface.format == PIPE_FORMAT_Z24_S8) + else if (sps->surface.format == PIPE_FORMAT_S8_Z24) scale = (float) ((1 << 24) - 1); else assert(0); /* XXX fix this someday */ diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index cf89d28941e..819243ae6e4 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -215,66 +215,69 @@ z32_write_quad_z(struct softpipe_surface *sps, } static void -z24s8_read_quad_z(struct softpipe_surface *sps, +s8z24_read_quad_z(struct softpipe_surface *sps, GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) { + static const GLuint mask = 0x00ffffff; const GLuint *src = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - zzzz[0] = src[0] >> 8; - zzzz[1] = src[1] >> 8; + zzzz[0] = src[0] & mask; + zzzz[1] = src[1] & mask; src += sps->surface.region->pitch; - zzzz[2] = src[0] >> 8; - zzzz[3] = src[1] >> 8; + zzzz[2] = src[0] & mask; + zzzz[3] = src[1] & mask; } static void -z24s8_write_quad_z(struct softpipe_surface *sps, +s8z24_write_quad_z(struct softpipe_surface *sps, GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) { + static const GLuint mask = 0xff000000; GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); assert(zzzz[0] <= 0xffffff); - dst[0] = (dst[0] & 0xff) | (zzzz[0] << 8); - dst[1] = (dst[1] & 0xff) | (zzzz[1] << 8); + dst[0] = (dst[0] & mask) | zzzz[0]; + dst[1] = (dst[1] & mask) | zzzz[1]; dst += sps->surface.region->pitch; - dst[0] = (dst[0] & 0xff) | (zzzz[2] << 8); - dst[1] = (dst[1] & 0xff) | (zzzz[3] << 8); + dst[0] = (dst[0] & mask) | zzzz[2]; + dst[1] = (dst[1] & mask) | zzzz[3]; } static void -z24s8_read_quad_stencil(struct softpipe_surface *sps, +s8z24_read_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) { const GLuint *src = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - ssss[0] = src[0] & 0xff; - ssss[1] = src[1] & 0xff; + ssss[0] = src[0] >> 24; + ssss[1] = src[1] >> 24; src += sps->surface.region->pitch; - ssss[2] = src[0] & 0xff; - ssss[3] = src[1] & 0xff; + ssss[2] = src[0] >> 24; + ssss[3] = src[1] >> 24; } static void -z24s8_write_quad_stencil(struct softpipe_surface *sps, +s8z24_write_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) { + static const GLuint mask = 0x00ffffff; GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - dst[0] = (dst[0] & 0xffffff00) | ssss[0]; - dst[1] = (dst[1] & 0xffffff00) | ssss[1]; + dst[0] = (dst[0] & mask) | (ssss[0] << 24); + dst[1] = (dst[1] & mask) | (ssss[1] << 24); dst += sps->surface.region->pitch; - dst[0] = (dst[0] & 0xffffff00) | ssss[2]; - dst[1] = (dst[1] & 0xffffff00) | ssss[3]; + dst[0] = (dst[0] & mask) | (ssss[2] << 24); + dst[1] = (dst[1] & mask) | (ssss[3] << 24); } @@ -324,11 +327,11 @@ init_quad_funcs(struct softpipe_surface *sps) sps->read_quad_z = z32_read_quad_z; sps->write_quad_z = z32_write_quad_z; break; - case PIPE_FORMAT_Z24_S8: - sps->read_quad_z = z24s8_read_quad_z; - sps->write_quad_z = z24s8_write_quad_z; - sps->read_quad_stencil = z24s8_read_quad_stencil; - sps->write_quad_stencil = z24s8_write_quad_stencil; + case PIPE_FORMAT_S8_Z24: + sps->read_quad_z = s8z24_read_quad_z; + sps->write_quad_z = s8z24_write_quad_z; + sps->read_quad_stencil = s8z24_read_quad_stencil; + sps->write_quad_stencil = s8z24_write_quad_stencil; break; case PIPE_FORMAT_U_S8: sps->read_quad_stencil = s8_read_quad_stencil; |