mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
mesa: Fix clamping to -1.0 in snorm_to_float
This patch fixes the return of a wrong value when x is lower than
-MAX_INT(src_bits) as the result would not be between [-1.0 1.0].
v2 by Samuel Iglesias <siglesias@igalia.com>:
- Modify snorm_to_float() to avoid doing the division when
x == -MAX_INT(src_bits)
Cc: 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
parent
3b5f206475
commit
7d1b08ac44
1 changed files with 1 additions and 1 deletions
|
|
@ -152,7 +152,7 @@ unorm_to_float(unsigned x, unsigned src_bits)
|
|||
static inline float
|
||||
snorm_to_float(int x, unsigned src_bits)
|
||||
{
|
||||
if (x == -MAX_INT(src_bits))
|
||||
if (x <= -MAX_INT(src_bits))
|
||||
return -1.0f;
|
||||
else
|
||||
return x * (1.0f / (float)MAX_INT(src_bits));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue