<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 5, 2015 at 11:02 PM, Connor Abbott <span dir="ltr"><<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The commit message should probably say something like "nir: Make<br>
nir_ssa_undef_instr_create initialize the destination". That we now<br>
need to pass in the number of components is just a side effect.<br></blockquote><div><br></div><div>Good point. Done. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
On Tue, Dec 16, 2014 at 1:13 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> ---<br>
> src/glsl/nir/nir.c | 5 ++---<br>
> src/glsl/nir/nir.h | 3 ++-<br>
> src/glsl/nir/nir_lower_variables.c | 11 +++++------<br>
> src/glsl/nir/nir_to_ssa.c | 5 ++---<br>
> 4 files changed, 11 insertions(+), 13 deletions(-)<br>
><br>
> diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c<br>
> index e128b48..2f79892 100644<br>
> --- a/src/glsl/nir/nir.c<br>
> +++ b/src/glsl/nir/nir.c<br>
> @@ -480,13 +480,12 @@ nir_parallel_copy_instr_create(void *mem_ctx)<br>
> }<br>
><br>
> nir_ssa_undef_instr *<br>
> -nir_ssa_undef_instr_create(void *mem_ctx)<br>
> +nir_ssa_undef_instr_create(void *mem_ctx, unsigned num_components)<br>
> {<br>
> nir_ssa_undef_instr *instr = ralloc(mem_ctx, nir_ssa_undef_instr);<br>
> instr_init(&instr->instr, nir_instr_type_ssa_undef);<br>
><br>
> - instr-><a href="http://def.name" target="_blank">def.name</a> = NULL;<br>
> - instr->def.parent_instr = &instr->instr;<br>
> + nir_ssa_def_init(&instr->instr, &instr->def, num_components, NULL);<br>
><br>
> return instr;<br>
> }<br>
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h<br>
> index b859322..74a1dda 100644<br>
> --- a/src/glsl/nir/nir.h<br>
> +++ b/src/glsl/nir/nir.h<br>
> @@ -1295,7 +1295,8 @@ nir_phi_instr *nir_phi_instr_create(void *mem_ctx);<br>
><br>
> nir_parallel_copy_instr *nir_parallel_copy_instr_create(void *mem_ctx);<br>
><br>
> -nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx);<br>
> +nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx,<br>
> + unsigned num_components);<br>
><br>
> nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var);<br>
> nir_deref_array *nir_deref_array_create(void *mem_ctx);<br>
> diff --git a/src/glsl/nir/nir_lower_variables.c b/src/glsl/nir/nir_lower_variables.c<br>
> index 16157b3..c5bc866 100644<br>
> --- a/src/glsl/nir/nir_lower_variables.c<br>
> +++ b/src/glsl/nir/nir_lower_variables.c<br>
> @@ -692,9 +692,9 @@ get_ssa_def_for_block(struct deref_node *node, nir_block *block,<br>
> /* If we got here then we don't have a definition that dominates the<br>
> * given block. This means that we need to add an undef and use that.<br>
> */<br>
> - nir_ssa_undef_instr *undef = nir_ssa_undef_instr_create(state->mem_ctx);<br>
> - nir_ssa_def_init(&undef->instr, &undef->def,<br>
> - glsl_get_vector_elements(node->type), NULL);<br>
> + nir_ssa_undef_instr *undef =<br>
> + nir_ssa_undef_instr_create(state->mem_ctx,<br>
> + glsl_get_vector_elements(node->type));<br>
> nir_instr_insert_before_cf_list(&state->impl->body, &undef->instr);<br>
> def_stack_push(node, &undef->def, state);<br>
> return &undef->def;<br>
> @@ -764,9 +764,8 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)<br>
> * should result in an undefined value.<br>
> */<br>
> nir_ssa_undef_instr *undef =<br>
> - nir_ssa_undef_instr_create(state->mem_ctx);<br>
> - nir_ssa_def_init(&undef->instr, &undef->def,<br>
> - intrin->num_components, NULL);<br>
> + nir_ssa_undef_instr_create(state->mem_ctx,<br>
> + intrin->num_components);<br>
><br>
> nir_instr_insert_before(&intrin->instr, &undef->instr);<br>
> nir_instr_remove(&intrin->instr);<br>
> diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c<br>
> index 01297e6..b352ded 100644<br>
> --- a/src/glsl/nir/nir_to_ssa.c<br>
> +++ b/src/glsl/nir/nir_to_ssa.c<br>
> @@ -159,9 +159,8 @@ static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state)<br>
> * We're using an undefined register, create a new undefined SSA value<br>
> * to preserve the information that this source is undefined<br>
> */<br>
> - nir_ssa_undef_instr *instr = nir_ssa_undef_instr_create(state->mem_ctx);<br>
> - nir_ssa_def_init(&instr->instr, &instr->def,<br>
> - reg->num_components, NULL);<br>
> + nir_ssa_undef_instr *instr =<br>
> + nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components);<br>
><br>
> /*<br>
> * We could just insert the undefined instruction before the instruction<br>
> --<br>
> 2.2.0<br>
><br>
</div></div>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>