diff options
author | Samuel Iglesias Gonsálvez <[email protected]> | 2017-08-29 06:56:26 +0200 |
---|---|---|
committer | Samuel Iglesias Gonsálvez <[email protected]> | 2017-09-11 10:03:39 +0200 |
commit | 5b1b088f2a176973b66e0765b4127c7882a12860 (patch) | |
tree | 528d3607623da49ed722e8991e04a845fb9cb268 | |
parent | 8d6b97a815874c7b695471a259fe4b6689890206 (diff) |
nir/spirv: fix chain access with different index bit sizes
Currently we support 32-bit indexes/offsets all over the driver, so we
convert them to that bit size.
Fixes dEQP-VK.spirv_assembly.instruction.*.indexing.*
v2: Use u2u32 instead (Jason).
Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index e03547c8d56..997b66f5420 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -102,10 +102,15 @@ vtn_access_link_as_ssa(struct vtn_builder *b, struct vtn_access_link link, if (link.mode == vtn_access_mode_literal) { return nir_imm_int(&b->nb, link.id * stride); } else if (stride == 1) { - return vtn_ssa_value(b, link.id)->def; + nir_ssa_def *ssa = vtn_ssa_value(b, link.id)->def; + if (ssa->bit_size != 32) + ssa = nir_u2u32(&b->nb, ssa); + return ssa; } else { - return nir_imul(&b->nb, vtn_ssa_value(b, link.id)->def, - nir_imm_int(&b->nb, stride)); + nir_ssa_def *src0 = vtn_ssa_value(b, link.id)->def; + if (src0->bit_size != 32) + src0 = nir_u2u32(&b->nb, src0); + return nir_imul(&b->nb, src0, nir_imm_int(&b->nb, stride)); } } |