From 3f4343c7cd247cd089ad8f63a72541da39346259 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Wed, 21 Sep 2022 07:43:52 -0700 Subject: [PATCH] nir/lower_task_shader: Don't fail adding a launch when last instruction is a jump MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: 8aff8d3dd42 ("nir: Add common task shader lowering to make the backend's job easier.") Reviewed-by: Timur Kristóf Part-of: --- src/compiler/nir/nir_lower_task_shader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c index 1d40d5a..c6c0f43 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)); } -- 2.7.4