[Mesa-dev] [PATCH 2/9] nir/lower_vec_to_movs: Add a state struct

Jason Ekstrand jason at jlekstrand.net
Sat Sep 19 13:52:25 PDT 2015


Go ahead and squash this in to the patch that adds the boolean return?
On Sep 18, 2015 10:37 AM, "Kenneth Graunke" <kenneth at whitecape.org> wrote:

> From: Jason Ekstrand <jason at jlekstrand.net>
>
> While we're here, we also fix up a couple of potential ralloc-parenting
> bugs.  In particular, we were calling nir_src_copy with the shader as the
> mem context instead of the instruction.
>
> v2 (Ken): Rebase.
>
> Reviewed-by: Eduardo Lima Mitev <elima at igalia.com> [v1]
> ---
>  src/glsl/nir/nir_lower_vec_to_movs.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/nir/nir_lower_vec_to_movs.c
> b/src/glsl/nir/nir_lower_vec_to_movs.c
> index 2cb0457..f5d30be 100644
> --- a/src/glsl/nir/nir_lower_vec_to_movs.c
> +++ b/src/glsl/nir/nir_lower_vec_to_movs.c
> @@ -32,6 +32,10 @@
>   * moves with partial writes.
>   */
>
> +struct vec_to_movs_state {
> +   nir_function_impl *impl;
> +};
> +
>  static bool
>  src_matches_dest_reg(nir_dest *dest, nir_src *src)
>  {
> @@ -185,9 +189,10 @@ try_coalesce(nir_alu_instr *vec, unsigned start_idx,
> nir_shader *shader)
>  }
>
>  static bool
> -lower_vec_to_movs_block(nir_block *block, void *void_impl)
> +lower_vec_to_movs_block(nir_block *block, void *void_state)
>  {
> -   nir_function_impl *impl = void_impl;
> +   struct vec_to_movs_state *state = void_state;
> +   nir_function_impl *impl = state->impl;
>     nir_shader *shader = impl->overload->function->shader;
>
>     nir_foreach_instr_safe(block, instr) {
> @@ -254,7 +259,9 @@ lower_vec_to_movs_block(nir_block *block, void
> *void_impl)
>  static void
>  nir_lower_vec_to_movs_impl(nir_function_impl *impl)
>  {
> -   nir_foreach_block(impl, lower_vec_to_movs_block, impl);
> +   struct vec_to_movs_state state = { impl };
> +
> +   nir_foreach_block(impl, lower_vec_to_movs_block, &state);
>  }
>
>  void
> --
> 2.5.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150919/d211da65/attachment.html>


More information about the mesa-dev mailing list