diff --git a/src/microsoft/compiler/dxil_nir_tess.c b/src/microsoft/compiler/dxil_nir_tess.c index 684193d50ae..55f04223c22 100644 --- a/src/microsoft/compiler/dxil_nir_tess.c +++ b/src/microsoft/compiler/dxil_nir_tess.c @@ -214,9 +214,11 @@ dxil_nir_split_tess_ctrl(nir_shader *nir, nir_function **patch_const_func) * will run sequentially. Then a loop is inserted so load_invocation_id will load the * loop counter. This loop continues until a barrier is reached, when the loop * is closed and the process begins again. - * - * First, sink load_invocation_id so that it's present on both sides of barriers. - * Each use gets a unique load of the invocation ID. + * + * First, sink load_invocation_id so that each use has its own local load. + * This ensures the load sits in the same pre/post-barrier region as its + * use, which the loop-wrapping pass below relies on — even for single-use + * loads whose use sits across a barrier. */ nir_builder b = nir_builder_create(patch_const_func_impl); nir_foreach_block(block, patch_const_func_impl) { @@ -225,8 +227,7 @@ dxil_nir_split_tess_ctrl(nir_shader *nir, nir_function **patch_const_func) continue; nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); if (intr->intrinsic != nir_intrinsic_load_invocation_id || - list_is_empty(&intr->def.uses) || - list_is_singular(&intr->def.uses)) + list_is_empty(&intr->def.uses)) continue; nir_foreach_use_including_if_safe(src, &intr->def) { b.cursor = nir_before_src(src);