From: Jason Ekstrand Date: Sat, 15 Dec 2018 15:57:26 +0000 (-0600) Subject: spirv: Sign-extend array indices X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c59f07684c0c99fad0c246dd4a475f6bef5d3cbc;p=mesa.git spirv: Sign-extend array indices The SPIR-V spec was recently updated to clarify that array indices are treated as signed integers. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Alejandro PiƱeiro Reviewed-by: Caio Marcelo de Oliveira Filho --- diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 025c6a23734..23fcd8b54d2 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -132,12 +132,12 @@ vtn_access_link_as_ssa(struct vtn_builder *b, struct vtn_access_link link, } else if (stride == 1) { nir_ssa_def *ssa = vtn_ssa_value(b, link.id)->def; if (ssa->bit_size != 32) - ssa = nir_u2u32(&b->nb, ssa); + ssa = nir_i2i32(&b->nb, ssa); return ssa; } else { nir_ssa_def *src0 = vtn_ssa_value(b, link.id)->def; if (src0->bit_size != 32) - src0 = nir_u2u32(&b->nb, src0); + src0 = nir_i2i32(&b->nb, src0); return nir_imul_imm(&b->nb, src0, stride); } }