summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_alu.c
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2018-04-26 16:54:26 +0200
committerKarol Herbst <[email protected]>2018-11-14 02:09:11 +0100
commitb4380cb070c0865f1fbfb3720056545665759bc3 (patch)
tree61f82d06be7dceefa71bf975ea6c36477e7e51b3 /src/compiler/spirv/vtn_alu.c
parent099728b1151184f7a110f3a16c999fe7ef9229cc (diff)
nir/spirv: cast shift operand to u32
v2: fix for specialization constants as well Reviewed-by: Jason Ekstrand <[email protected]> Cc: [email protected] Signed-off-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_alu.c')
-rw-r--r--src/compiler/spirv/vtn_alu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c
index 6860e7dc090..a23f8c29b5c 100644
--- a/src/compiler/spirv/vtn_alu.c
+++ b/src/compiler/spirv/vtn_alu.c
@@ -696,6 +696,17 @@ 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:
+ if (src[1]->bit_size != 32)
+ 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 */