50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
From e34357015cfbe0bb2545f6509d66c76da3232e7b Mon Sep 17 00:00:00 2001
|
|
From: Timothy Arceri <tarceri@itsqueeze.com>
|
|
Date: Fri, 15 Nov 2024 14:38:54 +1100
|
|
Subject: glsl: fix compiler global temp collisions
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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 7c5b21c03230.
|
|
|
|
Fixes: cbfc225e2bda ("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>
|
|
---
|
|
src/compiler/glsl/glsl_to_nir.cpp | 11 +++++++----
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
|
|
index 49db6d17e015..5e47477c8d9b 100644
|
|
--- a/src/compiler/glsl/glsl_to_nir.cpp
|
|
+++ b/src/compiler/glsl/glsl_to_nir.cpp
|
|
@@ -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:
|
|
--
|
|
cgit v1.2.3
|
|
|