From 424c466cdb6665398741e2f482c2a1e31375c0da Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Thu, 5 Feb 2026 21:14:05 +0100 Subject: [PATCH] nvk: Do not set lower_cs_local_index_to_id With task/mesh shaders, we need that lowering to not happen. Move to conditionally lower local invocation index with nir_lower_compute_system_values_options in case of compute shader. Signed-off-by: Mary Guillemard Reviewed-by: Mel Henning Tested-by: Thomas H.P. Andersen Part-of: --- src/nouveau/compiler/nak/api.rs | 1 - src/nouveau/vulkan/nvk_shader.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/api.rs b/src/nouveau/compiler/nak/api.rs index fde6808054b..49436ae53ee 100644 --- a/src/nouveau/compiler/nak/api.rs +++ b/src/nouveau/compiler/nak/api.rs @@ -139,7 +139,6 @@ fn nir_options(dev: &nv_device_info) -> nir_shader_compiler_options { lower_unpack_snorm_4x8: true, lower_insert_byte: true, lower_insert_word: true, - lower_cs_local_index_to_id: true, lower_device_index_to_zero: true, lower_isign: true, lower_uadd_sat: dev.sm < 70, diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index 7e35791fa2d..9e63076d335 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -383,6 +383,7 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, nir_lower_compute_system_values_options csv_options = { .has_base_workgroup_id = true, + .lower_local_invocation_index = mesa_shader_stage_is_compute(nir->info.stage), }; NIR_PASS(_, nir, nir_lower_compute_system_values, &csv_options); @@ -477,7 +478,10 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir, * nir_zero_initialize_shared_memory generates load_invocation_id which * has to be lowered to load_invocation_index. */ - NIR_PASS(_, nir, nir_lower_compute_system_values, NULL); + nir_lower_compute_system_values_options csv_options = { + .lower_local_invocation_index = mesa_shader_stage_is_compute(nir->info.stage), + }; + NIR_PASS(_, nir, nir_lower_compute_system_values, &csv_options); } }