summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorFaith Ekstrand <faith.ekstrand@collabora.com>2024-04-17 13:01:30 -0500
committerMarge Bot <emma+marge@anholt.net>2024-06-19 01:56:22 +0000
commit354f0958afefe579864d9dff047271a6c1e055c1 (patch)
tree39804a9deb6adc65bbd37aff0e3e9804af7d7bb7 /src/util
parentb187be5b1c4184b2286210c6a29011d0accfe736 (diff)
util/format_pack: Also use iround for SCALED formats
This is probably not necessary but more correct. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28793>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/format/u_format_pack.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
index 94b326e6d82..83702a04a07 100644
--- a/src/util/format/u_format_pack.py
+++ b/src/util/format/u_format_pack.py
@@ -414,11 +414,14 @@ def conversion_expr(src_channel,
if dst_channel.norm or dst_channel.type == FIXED:
dst_one = get_one(dst_channel)
if dst_channel.size <= 23:
- value = 'util_iround(%s * 0x%x)' % (value, dst_one)
+ value = '(%s * 0x%x)' % (value, dst_one)
else:
# bigger than single precision mantissa, use double
value = '(%s * (double)0x%x)' % (value, dst_one)
+ if dst_channel.size <= 23:
+ value = 'util_iround(%s)' % (value)
+
# Cast to an integer with the correct signedness first
if dst_channel.type == UNSIGNED:
value = '(uint%u_t)(%s) ' % (max(dst_channel.size, 32), value)