<div dir="ltr"><div>I don't think this does the right thing in the switch fall-through case but it will at least fail with a reasonable assert instead of just doing the wrong thing.</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 15, 2018 at 3:00 AM, Samuel Pitoiset <span dir="ltr"><<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@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="">We should stop walking through the CFG when the inner loop's<br>
break block ends up as the same block as the outer loop's<br>
continue block because we are already going to visit it.<br>
<br>
This fixes the following assertion which ends up by crashing<br>
in RADV or ANV:<br>
<br>
SPIR-V parsing FAILED:<br>
In file ../src/compiler/spirv/vtn_cfg.<wbr>c:381<br>
block->node.link.next == NULL<br>
0 bytes into the SPIR-V binary<br>
<br>
This also fixes a crash with a camera shader from SteamVR.<br>
<br>
</span>v2: make use of vtn_get_branch_type() and add an assertion<br>
<span class=""><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106090" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=106090</a><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106504" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=106504</a><br>
CC: 18.0 18.1 <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
</span> src/compiler/spirv/vtn_cfg.c | 13 +++++++++++++<br>
1 file changed, 13 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index e7d2f9ea61..ad4374112e 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -374,6 +374,19 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head *cf_list,<br>
<span class=""> vtn_cfg_walk_blocks(b, &loop->cont_body, new_loop_cont, NULL, NULL,<br>
new_loop_break, NULL, block);<br>
<br>
</span>+ enum vtn_branch_type branch_type =<br>
+ vtn_get_branch_type(b, new_loop_break, switch_case, switch_break,<br>
+ loop_break, loop_cont);<br>
+<br>
+ if (branch_type != vtn_branch_type_none) {<br>
<span class="">+ /* Stop walking through the CFG when this inner loop's break block<br>
+ * ends up as the same block as the outer loop's continue block<br>
+ * because we are already going to visit it.<br>
+ */<br>
</span>+ vtn_assert(branch_type == vtn_branch_type_loop_continue)<wbr>;<br>
+ return;<br>
+ }<br>
<div class="HOEnZb"><div class="h5">+<br>
block = new_loop_break;<br>
continue;<br>
}<br>
-- <br>
2.17.0<br>
<br>
______________________________<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>
</div></div></blockquote></div><br></div>