mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
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>
This commit is contained in:
parent
b187be5b1c
commit
354f0958af
1 changed files with 4 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue