From ef0bf50ae94acf69a980fdbe937f33900942b486 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 3 Jul 2025 12:13:12 -0400 Subject: [PATCH] zink: don't modify the u_foreach_bit64 bit inside the loop in loop_io_var_mask() this breaks the macro and causes infinite loops on patch locations in release builds cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index ffb992ef443..f1fb82e805b 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -5424,16 +5424,17 @@ loop_io_var_mask(nir_shader *nir, nir_variable_mode mode, bool indirect, bool pa { ASSERTED bool is_vertex_input = nir->info.stage == MESA_SHADER_VERTEX && mode == nir_var_shader_in; u_foreach_bit64(slot, mask) { + unsigned location = slot; if (patch) - slot += VARYING_SLOT_PATCH0; + location += VARYING_SLOT_PATCH0; /* this should've been handled explicitly */ - assert(is_vertex_input || !is_clipcull_dist(slot)); + assert(is_vertex_input || !is_clipcull_dist(location)); unsigned remaining = 0; do { /* scan the slot for usage */ - struct rework_io_state ris = scan_io_var_slot(nir, mode, slot, indirect); + struct rework_io_state ris = scan_io_var_slot(nir, mode, location, indirect); /* one of these must be true or things have gone very wrong */ assert(indirect || ris.component_mask || find_rework_var(nir, &ris) || remaining); /* release builds only */