[Mesa-dev] [PATCH 7/8] nir/spirv: cast shift operand to u32

Karol Herbst kherbst at redhat.com
Mon Jul 16 14:28:25 UTC 2018


Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/compiler/spirv/vtn_alu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c
index 5db6c7f0a87..d6f149d12e9 100644
--- a/src/compiler/spirv/vtn_alu.c
+++ b/src/compiler/spirv/vtn_alu.c
@@ -743,6 +743,16 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
          src[1] = tmp;
       }
 
+      switch (op) {
+      case nir_op_ishl:
+      case nir_op_ishr:
+      case nir_op_ushr:
+         src[1] = nir_u2u32(&b->nb, src[1]);
+         break;
+      default:
+         break;
+      }
+
       val->ssa->def = nir_build_alu(&b->nb, op, src[0], src[1], src[2], src[3]);
       break;
    } /* default */
-- 
2.17.1



More information about the mesa-dev mailing list