[Mesa-dev] [PATCH 2/8] anv/pipeline: Call nir_lower_constant_initializers
Iago Toral
itoral at igalia.com
Thu Jul 21 09:53:38 UTC 2016
On Wed, 2016-07-20 at 15:28 -0700, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
> src/intel/vulkan/anv_pipeline.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_pipeline.c
> b/src/intel/vulkan/anv_pipeline.c
> index 3723423..df57182 100644
> --- a/src/intel/vulkan/anv_pipeline.c
> +++ b/src/intel/vulkan/anv_pipeline.c
> @@ -149,6 +149,13 @@ anv_shader_compile_to_nir(struct anv_device
> *device,
> nir_lower_returns(nir);
> nir_validate_shader(nir);
>
> + /* We have to lower away local constant initializers right
> before we
> + * inline functions. That way they get properly initialized
> at the top
> + * of the function and not at the top of its caller.
> + */
> + nir_lower_constant_initializers(nir, nir_var_local);
> + nir_validate_shader(nir);
> +
> nir_inline_functions(nir);
> nir_validate_shader(nir);
>
> @@ -165,6 +172,12 @@ anv_shader_compile_to_nir(struct anv_device
> *device,
> nir_remove_dead_variables(nir, nir_var_system_value);
> nir_validate_shader(nir);
>
> + /* Now that we've deleted all but the main function, we can go
> ahead and
> + * lower the rest of the constant initializers.
> + */
> + nir_lower_constant_initializers(nir, ~0);
Couldn't we just use ~nir_var_local here?
> + nir_validate_shader(nir);
> +
> nir_propagate_invariant(nir);
> nir_validate_shader(nir);
>
More information about the mesa-dev
mailing list