From 74f07319533d39a509ddc3159a51cfe89cd47225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 20 Dec 2012 12:03:45 +0000 Subject: 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 --- src/gallium/auxiliary/util/u_format_zs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c index 816ef14..ed45c52 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 -- cgit v1.1