summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_utils.h
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-06-25 16:47:52 -0700
committerMatt Turner <[email protected]>2015-08-03 09:24:51 -0700
commit594fc0f85953d11c455e7ab549308a773b312d70 (patch)
treef23cb5f74f95e7f97fcc8e5c01b166c9a90edde9 /src/mesa/main/format_utils.h
parentf55c408067a3ea3529fcf7cbbaa1a041a4a8849d (diff)
mesa: Replace F_TO_I() with _mesa_lroundevenf().
I'm not sure what the true meaning of "The rounding mode may vary." is, but it is the case that the IROUND() path rounds differently than the other paths (and does it wrong, at that). Like _mesa_roundeven{f,}(), just add an use _mesa_lroundeven{f,}() that has known semantics. Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/main/format_utils.h')
-rw-r--r--src/mesa/main/format_utils.h5
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