diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c index 1d40d5ae481..c6c0f4391d2 100644 --- a/src/compiler/nir/nir_lower_task_shader.c +++ b/src/compiler/nir/nir_lower_task_shader.c @@ -417,7 +417,8 @@ nir_lower_task_shader(nir_shader *shader, * If the shader already had a launch_mesh_workgroups by any chance, * this will be removed. */ - builder.cursor = nir_after_cf_list(&builder.impl->body); + nir_block *last_block = nir_impl_last_block(impl); + builder.cursor = nir_after_block_before_jump(last_block); nir_launch_mesh_workgroups(&builder, nir_imm_zero(&builder, 3, 32)); }