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