[Mesa-dev] [PATCH 3/9] nir: Report progress from lower_vec_to_movs().

Jason Ekstrand jason at jlekstrand.net
Fri Sep 18 10:55:34 PDT 2015


Um, why?  I'm sure you have some reason but I don't immediately see how a
progress flag from lower_vec_to_movs is useful.  Some of the others
definitely are.
--Jason
On Sep 18, 2015 10:37 AM, "Kenneth Graunke" <kenneth at whitecape.org> wrote:

> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/nir/nir.h                   |  2 +-
>  src/glsl/nir/nir_lower_vec_to_movs.c | 16 ++++++++++++----
>  2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 31c0c27..0950289 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1826,7 +1826,7 @@ void nir_lower_vars_to_ssa(nir_shader *shader);
>  void nir_remove_dead_variables(nir_shader *shader);
>
>  void nir_move_vec_src_uses_to_dest(nir_shader *shader);
> -void nir_lower_vec_to_movs(nir_shader *shader);
> +bool nir_lower_vec_to_movs(nir_shader *shader);
>  void nir_lower_alu_to_scalar(nir_shader *shader);
>  void nir_lower_load_const_to_scalar(nir_shader *shader);
>
> diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c
> b/src/glsl/nir/nir_lower_vec_to_movs.c
> index f5d30be..b7ee4e8 100644
> --- a/src/glsl/nir/nir_lower_vec_to_movs.c
> +++ b/src/glsl/nir/nir_lower_vec_to_movs.c
> @@ -34,6 +34,7 @@
>
>  struct vec_to_movs_state {
>     nir_function_impl *impl;
> +   bool progress;
>  };
>
>  static bool
> @@ -251,24 +252,31 @@ lower_vec_to_movs_block(nir_block *block, void
> *void_state)
>
>        nir_instr_remove(&vec->instr);
>        ralloc_free(vec);
> +      state->progress = true;
>     }
>
>     return true;
>  }
>
> -static void
> +static bool
>  nir_lower_vec_to_movs_impl(nir_function_impl *impl)
>  {
> -   struct vec_to_movs_state state = { impl };
> +   struct vec_to_movs_state state = { impl, false };
>
>     nir_foreach_block(impl, lower_vec_to_movs_block, &state);
> +
> +   return state.progress;
>  }
>
> -void
> +bool
>  nir_lower_vec_to_movs(nir_shader *shader)
>  {
> +   bool progress = false;
> +
>     nir_foreach_overload(shader, overload) {
>        if (overload->impl)
> -         nir_lower_vec_to_movs_impl(overload->impl);
> +         progress = nir_lower_vec_to_movs_impl(overload->impl) ||
> progress;
>     }
> +
> +   return progress;
>  }
> --
> 2.5.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150918/1be5a583/attachment-0001.html>


More information about the mesa-dev mailing list