[Mesa-dev] [PATCH v2] nir/spirv: fix chain access with different index bit sizes
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Thu Sep 7 09:06:17 UTC 2017
This patch is unreviewed.
On Tue, 2017-08-29 at 08:42 +0200, Samuel Iglesias Gonsálvez wrote:
> 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.*
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> ---
> src/compiler/spirv/vtn_variables.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/spirv/vtn_variables.c
> b/src/compiler/spirv/vtn_variables.c
> index 4432e72e54..4f6acd2e07 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_i2i32(&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_i2i32(&b->nb, src0);
> + return nir_imul(&b->nb, src0, nir_imm_int(&b->nb, stride));
> }
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170907/dc67991e/attachment-0001.sig>
More information about the mesa-dev
mailing list