From 5eacaa95a782eb1e63f6c51dc3f1ace1960ab958 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 22 Aug 2020 13:48:35 +0200 Subject: [PATCH] spirv: fix 64 bit atomic inc and dec Signed-off-by: Karol Herbst Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/spirv/spirv_to_nir.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 4d7f9f2f8c3..3a886ce6556 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2889,13 +2889,16 @@ static void fill_common_atomic_sources(struct vtn_builder *b, SpvOp opcode, const uint32_t *w, nir_src *src) { + const struct glsl_type *type = vtn_get_type(b, w[1])->type; + unsigned bit_size = glsl_get_bit_size(type); + switch (opcode) { case SpvOpAtomicIIncrement: - src[0] = nir_src_for_ssa(nir_imm_int(&b->nb, 1)); + src[0] = nir_src_for_ssa(nir_imm_intN_t(&b->nb, 1, bit_size)); break; case SpvOpAtomicIDecrement: - src[0] = nir_src_for_ssa(nir_imm_int(&b->nb, -1)); + src[0] = nir_src_for_ssa(nir_imm_intN_t(&b->nb, -1, bit_size)); break; case SpvOpAtomicISub: -- 2.30.2