From: Jason Ekstrand Date: Mon, 11 Jan 2016 18:55:57 +0000 (-0800) Subject: anv/pipeline: Handle output lowering in anv_pipeline instead of spirv_to_nir X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=790565b06ec80de663820e136105ecb18125743f;p=mesa.git 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. --- diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index 26c2e58b9c3..44d03652e98 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -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; } diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index 9054d76892d..db4e19bf486 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -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); }