<div dir="ltr">Bump...<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 15, 2016 at 9:33 PM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 16 September 2016 at 14:16, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> Previously, we were saving off the last nir_block in a vtn_block before<br>
> moving on so that we could find the nir_block again when it came time to<br>
> handle phi sources. Unfortunately, NIR's control flow modification code is<br>
> inconsistent when it comes to how it splits blocks so the block pointer we<br>
> saved off may point to a block somewhere else in the shader by the time we<br>
> get around to handling phi sources. In order to get around this, we insert<br>
> a nop instruction and use that as the logical end of our block. Since the<br>
> control flow manipulation code respects instructions, the nop will keeps<br>
> its place like any other instruction and we can easily find the end of our<br>
> block when we need it.<br>
><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
<br>
</span>I'm not sure I'm good enough to review it, but this makes sense after<br>
I looked through it.<br>
<br>
It also fixes vkQuake on radv.<br>
<br>
Tested-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
Fixes: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=97233" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=97233</a><br>
<br>
Dave.<br>
<div><div class="h5"><br>
> ---<br>
> src/compiler/spirv/vtn_cfg.c | 6 ++++--<br>
> src/compiler/spirv/vtn_<wbr>private.h | 4 ++--<br>
> 2 files changed, 6 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
> index d9096f4..599ed69 100644<br>
> --- a/src/compiler/spirv/vtn_cfg.c<br>
> +++ b/src/compiler/spirv/vtn_cfg.c<br>
> @@ -518,7 +518,7 @@ vtn_handle_phi_second_pass(<wbr>struct vtn_builder *b, SpvOp opcode,<br>
> struct vtn_block *pred =<br>
> vtn_value(b, w[i + 1], vtn_value_type_block)->block;<br>
><br>
> - b->nb.cursor = nir_after_block_before_jump(<wbr>pred->end_block);<br>
> + b->nb.cursor = nir_after_instr(&pred->end_<wbr>nop->instr);<br>
><br>
> vtn_local_store(b, src, nir_deref_var_create(b, phi_var));<br>
> }<br>
> @@ -576,7 +576,9 @@ vtn_emit_cf_list(struct vtn_builder *b, struct list_head *cf_list,<br>
><br>
> vtn_foreach_instruction(b, block_start, block_end, handler);<br>
><br>
> - block->end_block = nir_cursor_current_block(b-><wbr>nb.cursor);<br>
> + block->end_nop = nir_intrinsic_instr_create(b-><wbr>nb.shader,<br>
> + nir_intrinsic_nop);<br>
> + nir_builder_instr_insert(&b-><wbr>nb, &block->end_nop->instr);<br>
><br>
> if ((*block->branch & SpvOpCodeMask) == SpvOpReturnValue) {<br>
> struct vtn_ssa_value *src = vtn_ssa_value(b, block->branch[1]);<br>
> diff --git a/src/compiler/spirv/vtn_<wbr>private.h b/src/compiler/spirv/vtn_<wbr>private.h<br>
> index 7f5444e..6f34f09 100644<br>
> --- a/src/compiler/spirv/vtn_<wbr>private.h<br>
> +++ b/src/compiler/spirv/vtn_<wbr>private.h<br>
> @@ -149,8 +149,8 @@ struct vtn_block {<br>
> /** Points to the switch case started by this block (if any) */<br>
> struct vtn_case *switch_case;<br>
><br>
> - /** The last block in this SPIR-V block. */<br>
> - nir_block *end_block;<br>
> + /** Every block ends in a nop intrinsic so that we can find it again */<br>
> + nir_intrinsic_instr *end_nop;<br>
> };<br>
><br>
> struct vtn_function {<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div>