diff options
author | Brian Paul <[email protected]> | 2012-02-12 11:30:54 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-02-15 14:07:43 -0700 |
commit | 5e81d3b85300077a0df1f1d77646a7e939d32a7f (patch) | |
tree | f4af21a57d71988981db0954303af45ea287e93e | |
parent | 5a70e12fc0897a3178c73b20d99fc0f11b180374 (diff) |
st/mesa: use _mesa_pack_ubyte_stencil_row() in draw_stencil_pixels()
Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 88e57b8c5d7..de4c189a836 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -33,6 +33,7 @@ #include "main/imports.h" #include "main/image.h" #include "main/bufferobj.h" +#include "main/format_pack.h" #include "main/macros.h" #include "main/mfeatures.h" #include "main/mtypes.h" @@ -1249,48 +1250,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, dst = drawMap + y * ptDraw->stride; src = buffer + i * width; - switch (ptDraw->resource->format) { - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - { - uint *dst4 = (uint *) dst; - int j; - assert(usage == PIPE_TRANSFER_READ_WRITE); - for (j = 0; j < width; j++) { - *dst4 = (*dst4 & 0xffffff) | (src[j] << 24); - dst4++; - } - } - break; - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - { - uint *dst4 = (uint *) dst; - int j; - assert(usage == PIPE_TRANSFER_READ_WRITE); - for (j = 0; j < width; j++) { - *dst4 = (*dst4 & 0xffffff00) | (src[j] & 0xff); - dst4++; - } - } - break; - case PIPE_FORMAT_S8_UINT: - assert(usage == PIPE_TRANSFER_WRITE); - memcpy(dst, src, width); - break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - { - uint *dst4 = (uint *) dst; - int j; - dst4++; - assert(usage == PIPE_TRANSFER_READ_WRITE); - for (j = 0; j < width; j++) { - *dst4 = src[j] & 0xff; - dst4 += 2; - } - } - break; - default: - assert(0); - } + _mesa_pack_ubyte_stencil_row(rbDraw->Base.Format, width, src, dst); } free(buffer); |