glsl: fix compiler global temp collisions

glsl ir creates these temps to copy global initialiser values for
example. To avoid collisions during linking due to 2 shaders in the same
stage having temps with the same name we make sure to define these as
function variables not shader globals. This will put the temps into the
global instructions wrapper created in 7c5b21c032.

Fixes: cbfc225e2b ("glsl: switch to a full nir based linker")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12136

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32202>
This commit is contained in:
Timothy Arceri 2024-11-15 14:38:54 +11:00 committed by Marge Bot
parent 25d4943481
commit e34357015c

View file

@ -481,11 +481,14 @@ nir_visitor::visit(ir_variable *ir)
switch(ir->data.mode) {
case ir_var_auto:
case ir_var_temporary:
if (is_global)
if (is_global) {
var->data.mode = nir_var_shader_temp;
else
var->data.mode = nir_var_function_temp;
break;
}
FALLTHROUGH;
case ir_var_temporary:
var->data.mode = nir_var_function_temp;
break;
case ir_var_function_in: