From: Karol Herbst Date: Sat, 22 Aug 2020 11:48:35 +0000 (+0200) Subject: spirv: fix 64 bit atomic inc and dec X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5eacaa95a782eb1e63f6c51dc3f1ace1960ab958;p=mesa.git spirv: fix 64 bit atomic inc and dec Signed-off-by: Karol Herbst Reviewed-by: Jason Ekstrand Part-of: --- 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: