Mesa (master): util/u_format: Round when converting depth values from float to z16_unorm.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Fri Dec 21 12:02:04 UTC 2012
Module: Mesa
Branch: master
Commit: 74f07319533d39a509ddc3159a51cfe89cd47225
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=74f07319533d39a509ddc3159a51cfe89cd47225
Author: José Fonseca <jfonseca at vmware.com>
Date: Thu Dec 20 12:03:45 2012 +0000
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 at vmware.com>
---
src/gallium/auxiliary/util/u_format_zs.c | 2 +-
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 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
More information about the mesa-commit
mailing list