summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-08-23 11:10:30 -0700
committerDylan Baker <[email protected]>2019-09-04 11:56:04 -0700
commitc96de002b77e64c85f7e98daba2566a593ee8f92 (patch)
treeac0c3e027e3b62432d2e5737f4f101bfe78f1dd4 /src
parent07ac4269a512464777f6f90abca7067506716526 (diff)
mesa: Fix _mesa_float_to_unorm() on 32-bit systems.
This fixes the following CTS test on 32-bit systems: GTF-GL46.gtf30.GL3Tests.packed_depth_stencil.packed_depth_stencil_init It does glGetTexImage of a 16-bit SNORM image, requesting 32-bit UNORM data. In get_tex_rgba_uncompressed, we round trip through float to handle image transfer ops for clamping. _mesa_format_convert does: _mesa_float_to_unorm(0.571428597f, 32) which translated to: _mesa_lroundevenf(0.571428597f * 0xffffffffu) which produced different results on 64-bit and 32-bit systems: 64-bit: result = 0x92492500 32-bit: result = 0x80000000 This is because the size of "long" varies between the two systems, and 0x92492500 is too large to fit in a signed 32-bit integer. To fix this, we switch to the new _mesa_i64roundevenf function which always does the 64-bit operation. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104395 Fixes: 594fc0f8595 ("mesa: Replace F_TO_I() with _mesa_lroundevenf().") Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Matt Turner <[email protected]> (cherry picked from commit e18cd5452aa4434fb22105eb939843381771b91c)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/format_utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h
index 78365cab533..3a528ceb3db 100644
--- a/src/mesa/main/format_utils.h
+++ b/src/mesa/main/format_utils.h
@@ -87,7 +87,7 @@ _mesa_float_to_unorm(float x, unsigned dst_bits)
else if (x > 1.0f)
return MAX_UINT(dst_bits);
else
- return _mesa_lroundevenf(x * MAX_UINT(dst_bits));
+ return _mesa_i64roundevenf(x * MAX_UINT(dst_bits));
}
static inline unsigned