nir: skip offset=0 in nir_io_add_const_offset_to_base

When offset=0, the pass was a no-op but was setting the progress
flag which could cause infinite loops when this pass is going
to be added to gl_nir_opts.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31684>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2024-10-16 13:59:38 +02:00
committed by Marge Bot
parent f24c799c67
commit 60578df33a
+7 -6
View File
@@ -3018,16 +3018,17 @@ add_const_offset_to_base_block(nir_block *block, nir_builder *b,
!nir_intrinsic_io_semantics(intrin).per_view) {
unsigned off = nir_src_as_uint(*offset);
nir_intrinsic_set_base(intrin, nir_intrinsic_base(intrin) + off);
if (off) {
nir_intrinsic_set_base(intrin, nir_intrinsic_base(intrin) + off);
sem.location += off;
sem.location += off;
b->cursor = nir_before_instr(&intrin->instr);
nir_src_rewrite(offset, nir_imm_int(b, 0));
progress = true;
}
/* non-indirect indexing should reduce num_slots */
sem.num_slots = is_dual_slot(intrin) ? 2 : 1;
nir_intrinsic_set_io_semantics(intrin, sem);
b->cursor = nir_before_instr(&intrin->instr);
nir_src_rewrite(offset, nir_imm_int(b, 0));
progress = true;
}
}
}