summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_tile.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2009-07-07 14:49:52 +0200
committerMichel Dänzer <[email protected]>2009-07-07 14:49:52 +0200
commit71633abafc935c25da9731bab48c228ceb9b4097 (patch)
tree0712162d0100a8419a3794c90313a3a7c1dc2bff /src/gallium/auxiliary/util/u_tile.c
parent25b492b976632269dfa3de164545d50a53c090ce (diff)
gallium: Fixes for clobbering stencil values in combined depth/stencil textures.
Also fix one case where a 32 bit depth value was incorrectly converted to a combined depth/stencil value.
Diffstat (limited to 'src/gallium/auxiliary/util/u_tile.c')
-rw-r--r--src/gallium/auxiliary/util/u_tile.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 9747a55cbfa..a0c8ed88f74 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -1202,6 +1202,19 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z, preserve stencil */
+ pDest[j] = (pDest[j] & 0xff000000) | ptrc[j] >> 8;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_X8Z24_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
@@ -1216,13 +1229,26 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
break;
case PIPE_FORMAT_Z24S8_UNORM:
+ {
+ uint *pDest = (uint *) (map + y * pt->stride + x*4);
+ assert(pt->usage == PIPE_TRANSFER_READ_WRITE);
+ for (i = 0; i < h; i++) {
+ for (j = 0; j < w; j++) {
+ /* convert 32-bit Z to 24-bit Z, preserve stencil */
+ pDest[j] = (pDest[j] & 0xff) | (ptrc[j] & 0xffffff00);
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
case PIPE_FORMAT_Z24X8_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit Z to 24-bit Z (0 stencil) */
- pDest[j] = ptrc[j] << 8;
+ pDest[j] = ptrc[j] & 0xffffff00;
}
pDest += pt->stride/4;
ptrc += srcStride;