mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 01:38:06 +02:00
nir/lower_bool_to_bit_size: Use the correct num_components for conversions
There's a nice little comment here saying we use the same write mask (an
out of date term in NIR) and swizzle but we're no longer actually doing
that. Depending on nir_builder magic, we may actually generate a scalar
when we really want a vector. The fix is to use more builder helpers
and just eat the potential copy.
Fixes: 3180656bbc ("nir: don't use nir_build_alu() with incomplete sources")
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39725>
This commit is contained in:
parent
240bae6b23
commit
711b3358a8
1 changed files with 5 additions and 9 deletions
|
|
@ -69,16 +69,12 @@ make_sources_canonical(nir_builder *b, nir_alu_instr *alu, uint32_t start_idx)
|
|||
if (nir_src_bit_size(alu->src[i].src) != bit_size) {
|
||||
b->cursor = nir_before_instr(&alu->instr);
|
||||
nir_op convert_op = get_bool_convert_opcode(bit_size);
|
||||
nir_alu_instr *conv_instr = nir_alu_instr_create(b->shader, convert_op);
|
||||
conv_instr->src[0].src = nir_src_for_ssa(alu->src[i].src.ssa);
|
||||
/* Retain the write mask and swizzle of the original instruction so
|
||||
* that we don’t unnecessarily create a vectorized instruction.
|
||||
/* Retain the number of components and swizzle of the original
|
||||
* instruction so that we don’t unnecessarily create a vectorized
|
||||
* instruction.
|
||||
*/
|
||||
memcpy(conv_instr->src[0].swizzle,
|
||||
alu->src[i].swizzle,
|
||||
sizeof(conv_instr->src[0].swizzle));
|
||||
|
||||
nir_def *new_src = nir_builder_alu_instr_finish_and_insert(b, conv_instr);
|
||||
nir_def *new_src =
|
||||
nir_build_alu1(b, convert_op, nir_ssa_for_alu_src(b, alu, i));
|
||||
|
||||
nir_src_rewrite(&alu->src[i].src, new_src);
|
||||
/* The swizzle will have been handled by the conversion instruction
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue