nir: convert unused mesh outputs to shared memory

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 <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17517>
This commit is contained in:
Marcin Ślusarz
2022-07-13 13:55:32 +02:00
committed by Marge Bot
parent e3e43cebff
commit 5e14445430

View File

@@ -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;
}