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:
parent
e8ca1a53a6
commit
74f0731953
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue