diff options
Diffstat (limited to 'src/mesa/main/format_utils.h')
-rw-r--r-- | src/mesa/main/format_utils.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h index 7f500ec78da..00ec7774dd2 100644 --- a/src/mesa/main/format_utils.h +++ b/src/mesa/main/format_utils.h @@ -33,6 +33,7 @@ #include "imports.h" #include "macros.h" +#include "util/rounding.h" extern const mesa_array_format RGBA32_FLOAT; extern const mesa_array_format RGBA8_UBYTE; @@ -84,7 +85,7 @@ _mesa_float_to_unorm(float x, unsigned dst_bits) else if (x > 1.0f) return MAX_UINT(dst_bits); else - return F_TO_I(x * MAX_UINT(dst_bits)); + return _mesa_lroundevenf(x * MAX_UINT(dst_bits)); } static inline unsigned @@ -128,7 +129,7 @@ _mesa_float_to_snorm(float x, unsigned dst_bits) else if (x > 1.0f) return MAX_INT(dst_bits); else - return F_TO_I(x * MAX_INT(dst_bits)); + return _mesa_lroundevenf(x * MAX_INT(dst_bits)); } static inline int |