<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jan 26, 2017 at 9:08 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixes:<br>
   dEQP-VK.spirv_assembly.<wbr>instruction.compute.<wbr>opspecconstantop.vector_<wbr>related<br>
   dEQP-VK.spirv_assembly.<wbr>instruction.graphics.<wbr>opspecconstantop.vector_<wbr>related*<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
 src/compiler/spirv/spirv_to_<wbr>nir.c | 52 ++++++++++++++++++++++++++++--<wbr>---------<br>
 1 file changed, 38 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index 2d773b4373..8f39670f47 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -1113,23 +1113,43 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,<br>
       SpvOp opcode = get_specialization(b, val, w[3]);<br>
       switch (opcode) {<br>
       case SpvOpVectorShuffle: {<br>
-         struct vtn_value *v0 = vtn_value(b, w[4], vtn_value_type_constant);<br>
-         struct vtn_value *v1 = vtn_value(b, w[5], vtn_value_type_constant);<br>
-         unsigned len0 = glsl_get_vector_elements(v0-><wbr>const_type);<br>
-         unsigned len1 = glsl_get_vector_elements(v1-><wbr>const_type);<br>
+         struct vtn_value *v0 = &b->values[w[4]];<br>
+         struct vtn_value *v1 = &b->values[w[5]];<br>
+<br>
+         assert(v0->value_type == vtn_value_type_constant ||<br>
+                v0->value_type == vtn_value_type_undef);<br>
+         assert(v1->value_type == vtn_value_type_constant ||<br>
+                v1->value_type == vtn_value_type_undef);<br>
+<br>
+         unsigned len0 = v0->value_type == vtn_value_type_constant ?<br>
+                         glsl_get_vector_elements(v0-><wbr>const_type) :<br>
+                         glsl_get_vector_elements(v0-><wbr>type->type);<br>
+         unsigned len1 = v1->value_type == vtn_value_type_constant ?<br>
+                         glsl_get_vector_elements(v1-><wbr>const_type) :<br>
+                         glsl_get_vector_elements(v1-><wbr>type->type);<br>
<br>
          assert(len0 + len1 < 16);<br>
<br>
          unsigned bit_size = glsl_get_bit_size(val->const_<wbr>type);<br>
-         assert(bit_size == glsl_get_bit_size(v0->const_<wbr>type) &&<br>
-                bit_size == glsl_get_bit_size(v1->const_<wbr>type));<br>
+         unsigned bit_size0 = v0->value_type == vtn_value_type_constant ?<br>
+                              glsl_get_bit_size(v0->const_<wbr>type) :<br>
+                              glsl_get_bit_size(v0->type-><wbr>type);<br>
+         unsigned bit_size1 = v1->value_type == vtn_value_type_constant ?<br>
+                              glsl_get_bit_size(v1->const_<wbr>type) :<br>
+                              glsl_get_bit_size(v1->type-><wbr>type);<br>
+<br>
+         assert(bit_size == bit_size0 && bit_size == bit_size1);<br>
<br>
          if (bit_size == 64) {<br>
             uint64_t u64[8];<br>
-            for (unsigned i = 0; i < len0; i++)<br>
-               u64[i] = v0->constant->values[0].u64[i]<wbr>;<br>
-            for (unsigned i = 0; i < len1; i++)<br>
-               u64[len0 + i] = v1->constant->values[0].u64[i]<wbr>;<br>
+            for (unsigned i = 0; i < len0; i++) {<br>
+               if (v0->value_type == vtn_value_type_constant)<br>
+                  u64[i] = v0->constant->values[0].u64[i]<wbr>;<br></blockquote><div><br></div><div>You could put the if outside of the loop.  Either way...<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            }<br>
+            for (unsigned i = 0; i < len1; i++) {<br>
+               if (v1->value_type == vtn_value_type_constant)<br>
+                  u64[len0 + i] = v1->constant->values[0].u64[i]<wbr>;<br>
+            }<br>
<br>
             for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {<br>
                uint32_t comp = w[i + 6];<br>
@@ -1143,11 +1163,15 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,<br>
             }<br>
          } else {<br>
             uint32_t u32[8];<br>
-            for (unsigned i = 0; i < len0; i++)<br>
-               u32[i] = v0->constant->values[0].u32[i]<wbr>;<br>
+            for (unsigned i = 0; i < len0; i++) {<br>
+               if (v0->value_type == vtn_value_type_constant)<br>
+                  u32[i] = v0->constant->values[0].u32[i]<wbr>;<br>
+            }<br>
<br>
-            for (unsigned i = 0; i < len1; i++)<br>
-               u32[len0 + i] = v1->constant->values[0].u32[i]<wbr>;<br>
+            for (unsigned i = 0; i < len1; i++) {<br>
+               if (v1->value_type == vtn_value_type_constant)<br>
+                  u32[len0 + i] = v1->constant->values[0].u32[i]<wbr>;<br>
+            }<br>
<br>
             for (unsigned i = 0, j = 0; i < count - 6; i++, j++) {<br>
                uint32_t comp = w[i + 6];<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.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>
</font></span></blockquote></div><br></div></div>