<div dir="ltr">Also, I don't see why this one and the first two can't land today.  They're obvious clean-ups.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 3:11 PM Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></div><div>Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 9:48 AM Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">v2: fix for specialization constants as well<br>
<br>
Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>><br>
---<br>
 src/compiler/spirv/spirv_to_nir.c | 20 ++++++++++++++++++++<br>
 src/compiler/spirv/vtn_alu.c      | 11 +++++++++++<br>
 2 files changed, 31 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c<br>
index d72f07dc1f9..2c214324774 100644<br>
--- a/src/compiler/spirv/spirv_to_nir.c<br>
+++ b/src/compiler/spirv/spirv_to_nir.c<br>
@@ -1813,6 +1813,26 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,<br>
             src[j] = src_val->constant->values[0];<br>
          }<br>
<br>
+         /* fix up fixed size sources */<br>
+         switch (op) {<br>
+         case nir_op_ishl:<br>
+         case nir_op_ishr:<br>
+         case nir_op_ushr: {<br>
+            if (bit_size == 32)<br>
+               break;<br>
+            for (unsigned i = 0; i < num_components; ++i) {<br>
+               switch (bit_size) {<br>
+               case 64: src[1].u32[i] = src[1].u64[i]; break;<br>
+               case 16: src[1].u32[i] = src[1].u16[i]; break;<br>
+               case  8: src[1].u32[i] = src[1].u8[i];  break;<br>
+               }<br>
+            }<br>
+            break;<br>
+         }<br>
+         default:<br>
+            break;<br>
+         }<br>
+<br>
          val->constant->values[0] =<br>
             nir_eval_const_opcode(op, num_components, bit_size, src);<br>
          break;<br>
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c<br>
index ea25d4bcbdc..32825da29cb 100644<br>
--- a/src/compiler/spirv/vtn_alu.c<br>
+++ b/src/compiler/spirv/vtn_alu.c<br>
@@ -743,6 +743,17 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,<br>
          src[1] = tmp;<br>
       }<br>
<br>
+      switch (op) {<br>
+      case nir_op_ishl:<br>
+      case nir_op_ishr:<br>
+      case nir_op_ushr:<br>
+         if (src[1]->bit_size != 32)<br>
+            src[1] = nir_u2u32(&b->nb, src[1]);<br>
+         break;<br>
+      default:<br>
+         break;<br>
+      }<br>
+<br>
       val->ssa->def = nir_build_alu(&b->nb, op, src[0], src[1], src[2], src[3]);<br>
       break;<br>
    } /* default */<br>
-- <br>
2.19.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>
</blockquote></div>