nir/lower_task_shader: Don't fail adding a launch when last instruction is a jump

Fixes: 8aff8d3dd4 ("nir: Add common task shader lowering to make the backend's job easier.")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18442>
(cherry picked from commit 3f4343c7cd)
This commit is contained in:
Caio Oliveira
2022-09-21 07:43:52 -07:00
committed by Dylan Baker
parent 6cf16955f7
commit d600acf6d9
2 changed files with 3 additions and 2 deletions

View File

@@ -1255,7 +1255,7 @@
"description": "nir/lower_task_shader: Don't fail adding a launch when last instruction is a jump",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "8aff8d3dd42ecc399f1d7d23ddd641e7e3fce777"
},

View File

@@ -398,7 +398,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));
}