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>
This commit is contained in:
José Fonseca 2012-12-20 12:03:45 +00:00
parent e8ca1a53a6
commit 74f0731953
1 changed files with 1 additions and 1 deletions

View File

@ -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