From: Jason Ekstrand <jason.ekstr...@intel.com> 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 <sigles...@igalia.com>: - Modify snorm_to_float() to avoid doing the division when x == -MAX_INT(src_bits) Reviewed-by: Ian Romanick <ian.d.roman...@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 93a0cea..5dd0848 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)); -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev