summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-12-20 12:03:45 +0000
committerJosé Fonseca <jfonseca@vmware.com>2012-12-21 10:04:51 +0000
commit74f07319533d39a509ddc3159a51cfe89cd47225 (patch)
tree70a169f0aae9541c00f63c88628a9b7fa69aa5aa /src/gallium/auxiliary
parente8ca1a53a625544ea30b394be905ff7e51d78af6 (diff)
util/u_format: Round when converting depth values from float to z16_unorm.
This makes the z16_unorm -> float -> z16_unorm conversion lossless. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_format_zs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c
index 816ef14204c..ed45c52f9c9 100644
--- a/src/gallium/auxiliary/util/u_format_zs.c
+++ b/src/gallium/auxiliary/util/u_format_zs.c
@@ -72,7 +72,7 @@ static INLINE uint16_t
z32_float_to_z16_unorm(float z)
{
const float scale = 0xffff;
- return (uint16_t)(z * scale);
+ return (uint16_t)(z * scale + 0.5f);
}
static INLINE float