From ff2ebdc4d694a0b4a408e7d874c3b1efa85206aa Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Tue, 13 Aug 2024 15:20:04 +0200 Subject: [PATCH] nir/format_convert: Promote input to 32-bit before packing integers If we don't do that and the source is not 32-bit we end up with a bit_size mismatch when doing the ior operation. Signed-off-by: Boris Brezillon Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir_format_convert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/nir/nir_format_convert.c b/src/compiler/nir/nir_format_convert.c index 76461b78835..ad8023699ee 100644 --- a/src/compiler/nir/nir_format_convert.c +++ b/src/compiler/nir/nir_format_convert.c @@ -102,6 +102,8 @@ nir_format_pack_uint_unmasked(nir_builder *b, nir_def *color, assert(num_components >= 1 && num_components <= 4); nir_def *packed = nir_imm_int(b, 0); unsigned offset = 0; + + color = nir_u2u32(b, color); for (unsigned i = 0; i < num_components; i++) { if (bits[i] == 0) continue; @@ -120,6 +122,8 @@ nir_format_pack_uint_unmasked_ssa(nir_builder *b, nir_def *color, { nir_def *packed = nir_imm_int(b, 0); nir_def *offset = nir_imm_int(b, 0); + + color = nir_u2u32(b, color); for (unsigned i = 0; i < bits->num_components; i++) { packed = nir_ior(b, packed, nir_ishl(b, nir_channel(b, color, i), offset)); offset = nir_iadd(b, offset, nir_channel(b, bits, i));