diff --git a/.pick_status.json b/.pick_status.json index 89a7d188a73..98d5cd54ce4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -984,7 +984,7 @@ "description": "nir/lower_bool_to_bit_size: Use the correct num_components for conversions", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "3180656bbc9d9494418ba2b827691559d729ee80", "notes": null diff --git a/src/compiler/nir/nir_lower_bool_to_bitsize.c b/src/compiler/nir/nir_lower_bool_to_bitsize.c index e1c5acb89e8..80879e67ce1 100644 --- a/src/compiler/nir/nir_lower_bool_to_bitsize.c +++ b/src/compiler/nir/nir_lower_bool_to_bitsize.c @@ -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