aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/format
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2020-03-24 19:54:06 +0100
committerMarge Bot <[email protected]>2020-03-25 19:16:13 +0000
commit3cbcb1b73e5f764ed87fdcd1dea8a921e73bfd82 (patch)
tree2d770ce2b5873ec416117f3f625f9cf1168fc523 /src/util/format
parent9e78f17b74a862e34891901cde8292f91adeb655 (diff)
gallium/util: Add back (and rename) util_float_to_half implementation
This implementation was removed by 8b8af6d3 ("gallium/util: Switch util_float_to_half to _mesa_float_to_half()'s impl.") It was not actually broken, but _mesa_float_to_half() implements round-to-nearest-even, whereas util_float_to_half() implemented round-to-zero. So rename it appropriately. GL actually never cares about rounding (except a broken piglit test), however d3d10 very much does and requires RTZ for float to half conversion. Moreover, apparently at least radeon gpus actually always do RTZ when doing RT writes (and I'd suspect for shader image writes as well). Hence it seems appropriate to hook up this rtz function to the format instead. This will cause llvmpipe and softpipe to use rtz rounding for clears with half float formats, and softpipe would use rtz behavior for rt writes as well (llvmpipe has that hardcoded), not sure if "real" hw drivers hit this function for much. (For shader opcodes would still need to figure out what rounding to use appropriately, but this is a question for another day.) Note should probably unify with _mesa_float_to_float16_rtz. Unclear at this point which one is better, so just restore previous function here. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312>
Diffstat (limited to 'src/util/format')
-rw-r--r--src/util/format/u_format_pack.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
index 5a1763d1e6f..c8749a2c047 100644
--- a/src/util/format/u_format_pack.py
+++ b/src/util/format/u_format_pack.py
@@ -437,7 +437,7 @@ def conversion_expr(src_channel,
src_size = 32
if dst_channel.size == 16:
- value = 'util_float_to_half(%s)' % value
+ value = 'util_float_to_half_rtz(%s)' % value
elif dst_channel.size == 64 and src_size < 64:
value = '(double)%s' % value