nir/lower_outputs_to_temporaries: Reparent the output name

We copy the output, make the old output the temporary, and give the
temporary a new name.  The copy keeps the pointer to the old name.  This
works just fine up until the point where we lower things to SSA and delete
the old variable and, with it, the name.  Instead, we should re-parent to
the copy.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
This commit is contained in:
Jason Ekstrand 2015-09-10 13:56:08 -07:00
parent d4e29af234
commit 794355e771
1 changed files with 3 additions and 0 deletions

View File

@ -91,6 +91,9 @@ nir_lower_outputs_to_temporaries(nir_shader *shader)
/* The orignal is now the temporary */
nir_variable *temp = var;
/* Reparent the name to the new variable */
ralloc_steal(output, output->name);
/* Give the output a new name with @out-temp appended */
temp->name = ralloc_asprintf(var, "%s@out-temp", output->name);
temp->data.mode = nir_var_global;