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 in7c5b21c032
. 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> (cherry picked from commite34357015c
)
This commit is contained in:

committed by
Dylan Baker

parent
bbf9d3fe5a
commit
29cf77957b
@@ -1244,7 +1244,7 @@
|
||||
"description": "glsl: fix compiler global temp collisions",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "cbfc225e2bda2c8627a4580fa3a9b63bfb7133e0",
|
||||
"notes": null
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user