<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 6, 2017 at 9:18 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">These are currently getting hit by the Skia Vulkan back-end<br></blockquote><div><br></div><div>Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=99465">https://bugs.freedesktop.org/show_bug.cgi?id=99465</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 src/compiler/spirv/spirv_to_<wbr>nir.c | 15 +++++++++++++++<br>
 1 file changed, 15 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index 9f0b8fd..416e12a 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -2334,9 +2334,17 @@ vtn_vector_construct(struct vtn_builder *b, unsigned num_components,<br>
    nir_alu_instr *vec = create_vec(b->shader, num_components,<br>
                                    srcs[0]->bit_size);<br>
<br>
+   /* From the SPIR-V 1.1 spec for OpCompositeConstruct:<br>
+    *<br>
+    *    "When constructing a vector, there must be at least two Constituent<br>
+    *    operands."<br>
+    */<br>
+   assert(num_srcs >= 2);<br>
+<br>
    unsigned dest_idx = 0;<br>
    for (unsigned i = 0; i < num_srcs; i++) {<br>
       nir_ssa_def *src = srcs[i];<br>
+      assert(dest_idx + src->num_components <= num_components);<br>
       for (unsigned j = 0; j < src->num_components; j++) {<br>
          vec->src[dest_idx].src = nir_src_for_ssa(src);<br>
          vec->src[dest_idx].swizzle[0] = j;<br>
@@ -2344,6 +2352,13 @@ vtn_vector_construct(struct vtn_builder *b, unsigned num_components,<br>
       }<br>
    }<br>
<br>
+   /* From the SPIR-V 1.1 spec for OpCompositeConstruct:<br>
+    *<br>
+    *    "When constructing a vector, the total number of components in all<br>
+    *    the operands must equal the number of components in Result Type."<br>
+    */<br>
+   assert(dest_idx == num_components);<br>
+<br>
    nir_builder_instr_insert(&b-><wbr>nb, &vec->instr);<br>
<br>
    return &vec->dest.dest.ssa;<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div></div>