aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_tile.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-28 14:07:02 +0200
committermarha <marha@users.sourceforge.net>2012-08-28 14:07:02 +0200
commit05d67ae9117e5157fd1a5175dde6d7e48caf4653 (patch)
tree601c92c99a901b165664df7482c7baf538d4d7c5 /mesalib/src/gallium/auxiliary/util/u_tile.c
parentb3462c12542a69eeaa3fe90fddfbb15d30c18158 (diff)
downloadvcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.gz
vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.bz2
vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.zip
fontconfig mesa xserver git update 28 Aug 2012
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_tile.c')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_tile.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_tile.c b/mesalib/src/gallium/auxiliary/util/u_tile.c
index ea4b91f95..48e73c40b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_tile.c
+++ b/mesalib/src/gallium/auxiliary/util/u_tile.c
@@ -679,6 +679,28 @@ pipe_get_tile_z(struct pipe_context *pipe,
}
}
break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ {
+ const float *ptrc = (const float *)(map + y * pt->stride + x*4);
+ 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] = 0;
+ }
+ else if (ptrc[j] >= 1.0) {
+ pDest[j] = 0xffffffff;
+ }
+ else {
+ double z = ptrc[j] * 0xffffffff;
+ pDest[j] = (uint) z;
+ }
+ }
+ pDest += dstStride;
+ ptrc += pt->stride/4;
+ }
+ }
+ break;
default:
assert(0);
}
@@ -786,6 +808,20 @@ pipe_put_tile_z(struct pipe_context *pipe,
}
}
break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ {
+ float *pDest = (float *) (map + y * pt->stride + x*2);
+ 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] = ptrc[j] * scale;
+ }
+ pDest += pt->stride/4;
+ ptrc += srcStride;
+ }
+ }
+ break;
default:
assert(0);
}