<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 11:50 PM, Michael Schellenberger Costa <span dir="ltr"><<a href="mailto:mschellenbergercosta@googlemail.com" target="_blank">mschellenbergercosta@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jason,<br>
<span class=""><br>
Am 19.05.2016 um 06:42 schrieb Jason Ekstrand:<br>
> Originally we removed the instruction, changed the source, and then<br>
> re-inserted it.  This works, but nir_instr_rewrite_src is a bit more<br>
> obviously correct.<br>
> ---<br>
>  src/intel/vulkan/anv_nir_apply_dynamic_offsets.c | 6 +++---<br>
>  1 file changed, 3 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c<br>
> index 6a28953..a7ed3e5 100644<br>
> --- a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c<br>
> +++ b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c<br>
> @@ -80,9 +80,10 @@ apply_dynamic_offsets_block(nir_block *block, nir_builder *b,<br>
>        nir_ssa_dest_init(&offset_load->instr, &offset_load->dest, 2, 32, NULL);<br>
>        nir_builder_instr_insert(b, &offset_load->instr);<br>
><br>
> -      nir_src *offset_src = nir_get_io_offset_src(intrin);<br>
</span>I think you didnt want to remove *offset_src here, given that it is used<br>
below and reintroduced in the next patch?<br></blockquote><div><br></div><div>Ugh... Thanks.  This patch doesn't even build.  I knew that series needed a little work before I sent it :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888">--Michael<br>
</font></span><div class="HOEnZb"><div class="h5">> -      nir_ssa_def *new_offset = nir_iadd(b, offset_src->ssa,<br>
> +      nir_ssa_def *new_offset = nir_iadd(b, nir_ssa_for_src(*offset_src),<br>
>                                           &offset_load->dest.ssa);<br>
> +      nir_instr_rewrite_src(&intrin->instr, nir_get_io_offset_src(intrin),<br>
> +                            nir_src_for_ssa(new_offset));<br>
><br>
>        /* In order to avoid out-of-bounds access, we predicate */<br>
>        nir_ssa_def *pred = nir_uge(b, nir_channel(b, &offset_load->dest.ssa, 1),<br>
> @@ -92,7 +93,6 @@ apply_dynamic_offsets_block(nir_block *block, nir_builder *b,<br>
>        nir_cf_node_insert(b->cursor, &if_stmt->cf_node);<br>
><br>
>        nir_instr_remove(&intrin->instr);<br>
> -      *offset_src = nir_src_for_ssa(new_offset);<br>
>        nir_instr_insert_after_cf_list(&if_stmt->then_list, &intrin->instr);<br>
><br>
>        if (intrin->intrinsic != nir_intrinsic_store_ssbo) {<br>
><br>
</div></div></blockquote></div><br></div></div>