diff options
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_tile.c')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_tile.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c index f4b5cad0e..6c618a674 100644 --- a/mesalib/src/gallium/auxiliary/util/u_tile.c +++ b/mesalib/src/gallium/auxiliary/util/u_tile.c @@ -678,6 +678,28 @@ pipe_get_tile_z(struct pipe_transfer *pt, } } break; + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + { + const float *ptrc = (const float *)(map + y * pt->stride + x*8); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert float Z to 32-bit Z */ + if (ptrc[j] <= 0.0) { + pDest[j*2] = 0; + } + else if (ptrc[j] >= 1.0) { + pDest[j*2] = 0xffffffff; + } + else { + double z = ptrc[j] * 0xffffffff; + pDest[j*2] = (uint) z; + } + } + pDest += dstStride; + ptrc += pt->stride/4; + } + } + break; default: assert(0); } @@ -779,7 +801,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, break; case PIPE_FORMAT_Z32_FLOAT: { - float *pDest = (float *) (map + y * pt->stride + x*2); + float *pDest = (float *) (map + y * pt->stride + x*4); for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 32-bit integer Z to float Z */ @@ -791,6 +813,20 @@ pipe_put_tile_z(struct pipe_transfer *pt, } } break; + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + { + float *pDest = (float *) (map + y * pt->stride + x*8); + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + /* convert 32-bit integer Z to float Z */ + const double scale = 1.0 / 0xffffffffU; + pDest[j*2] = ptrc[j] * scale; + } + pDest += pt->stride/4; + ptrc += srcStride; + } + } + break; default: assert(0); } |