[Mesa-dev] [PATCH] nir: Fix output variable names

Eduardo Lima Mitev elima at igalia.com
Fri Sep 11 00:24:59 PDT 2015


Commit 1dbe4af9c9e318525fc082b542b93fb7f1e5efba
"nir: Add a pass to lower outputs to temporary variables" messed up output
variable names. The issue can be reproduced by dumping the NIR shaders
with INTEL_DEBUG="vs,fs".
---
 src/glsl/nir/nir_lower_outputs_to_temporaries.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_lower_outputs_to_temporaries.c b/src/glsl/nir/nir_lower_outputs_to_temporaries.c
index b730cad..e9c4c0d 100644
--- a/src/glsl/nir/nir_lower_outputs_to_temporaries.c
+++ b/src/glsl/nir/nir_lower_outputs_to_temporaries.c
@@ -87,12 +87,13 @@ nir_lower_outputs_to_temporaries(nir_shader *shader)
    foreach_list_typed(nir_variable, var, node, &state.old_outputs) {
       nir_variable *output = ralloc(shader, nir_variable);
       memcpy(output, var, sizeof *output);
+      output->name = ralloc_strdup(output, var->name);
 
       /* The orignal is now the temporary */
       nir_variable *temp = var;
 
       /* Give the output a new name with @out-temp appended */
-      temp->name = ralloc_asprintf(var, "%s at out-temp", output->name);
+      temp->name = ralloc_asprintf(output, "%s at out-temp", output->name);
       temp->data.mode = nir_var_global;
       temp->constant_initializer = NULL;
 
-- 
2.4.6



More information about the mesa-dev mailing list