mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 09:50:08 +01:00
nir/lower_blend: Fix nir_blend_logicop() for 8/16-bit integer formats
src and dst can be integer types, and doing an f2f on such types
messes up with the original value. Make sure we keep the original type
when {up,down}sizing the src, dst and out values.
Fixes: f3de2bd6c2 ("nir: Add blend lowering pass")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28839>
This commit is contained in:
parent
e5f133ccc4
commit
34ffa4cd10
1 changed files with 7 additions and 4 deletions
|
|
@ -319,9 +319,12 @@ nir_blend_logicop(
|
|||
if (util_format_is_float(format) || util_format_is_srgb(format))
|
||||
return src;
|
||||
|
||||
nir_alu_type type =
|
||||
util_format_is_pure_integer(format) ? nir_type_uint : nir_type_float;
|
||||
|
||||
if (bit_size != 32) {
|
||||
src = nir_f2f32(b, src);
|
||||
dst = nir_f2f32(b, dst);
|
||||
src = nir_convert_to_bit_size(b, src, type, 32);
|
||||
dst = nir_convert_to_bit_size(b, dst, type, 32);
|
||||
}
|
||||
|
||||
assert(src->num_components <= 4);
|
||||
|
|
@ -358,8 +361,8 @@ nir_blend_logicop(
|
|||
assert(util_format_is_pure_integer(format));
|
||||
}
|
||||
|
||||
if (bit_size == 16)
|
||||
out = nir_f2f16(b, out);
|
||||
if (bit_size != 32)
|
||||
out = nir_convert_to_bit_size(b, out, type, bit_size);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue