From 5e14445430454627d3703c2e467c811889eb0716 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Wed, 13 Jul 2022 13:55:32 +0200 Subject: [PATCH] nir: convert unused mesh outputs to shared memory MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Otherwise reads from output in one subgroup may not see writes from other subgroups. Temp variables are later converted to scratch, so even within one subgroup we may not see correct values. Test case in https://gitlab.freedesktop.org/mesa/crucible/-/merge_requests/115 Reviewed-by: Timur Kristóf Part-of: --- src/compiler/nir/nir_linking_helpers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 613b424..8304e82 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -161,8 +161,12 @@ nir_remove_unused_io_vars(nir_shader *shader, if (!(other_stage & get_variable_io_mask(var, shader->info.stage))) { /* This one is invalid, make it a global variable instead */ + if (shader->info.stage == MESA_SHADER_MESH && + (shader->info.outputs_read & BITFIELD64_BIT(var->data.location))) + var->data.mode = nir_var_mem_shared; + else + var->data.mode = nir_var_shader_temp; var->data.location = 0; - var->data.mode = nir_var_shader_temp; progress = true; } -- 2.7.4