[Mesa-dev] [PATCH 1/8] main/format_util: Fix a bug in one of the format helper functions

Jason Ekstrand jason at jlekstrand.net
Sat Aug 23 15:23:11 PDT 2014


We need to correct for snorm values less than -MAX_INT, not equal to.

Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
---
 src/mesa/main/format_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
index 240e3bc..7a00169 100644
--- a/src/mesa/main/format_utils.c
+++ b/src/mesa/main/format_utils.c
@@ -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));
-- 
2.1.0



More information about the mesa-dev mailing list