anv/pipeline: Handle output lowering in anv_pipeline instead of spirv_to_nir

While we're at it, we delete any unused variables.  This allows us to prune
variables that are not used in the current stage from the shader.
This commit is contained in:
Jason Ekstrand 2016-01-11 10:55:57 -08:00
parent b8ec48ee76
commit 790565b06e
2 changed files with 7 additions and 5 deletions

View file

@ -3526,10 +3526,5 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
ralloc_free(b);
/* Because we can still have output reads in NIR, we need to lower
* outputs to temporaries before we are truely finished.
*/
nir_lower_outputs_to_temporaries(entry_point->shader, entry_point);
return entry_point;
}

View file

@ -133,6 +133,13 @@ anv_shader_compile_to_nir(struct anv_device *device,
assert(exec_list_length(&nir->functions) == 1);
entry_point->name = ralloc_strdup(entry_point, "main");
nir_remove_dead_variables(nir, nir_var_shader_in);
nir_remove_dead_variables(nir, nir_var_shader_out);
nir_remove_dead_variables(nir, nir_var_system_value);
nir_validate_shader(nir);
nir_lower_outputs_to_temporaries(entry_point->shader, entry_point);
nir_lower_system_values(nir);
nir_validate_shader(nir);
}