From 5b5b45ebf61605b970cf9b64e0937260b7219f3f Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 9 Jun 2020 08:35:26 -0700 Subject: [PATCH] spriv: don't set num_components for non-vectorised intrinsics Signed-off-by: Rob Clark Reviewed-by: Jason Ekstrand Part-of: --- src/compiler/spirv/spirv_to_nir.c | 7 +++---- src/compiler/spirv/vtn_subgroup.c | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 10c5de55216..b222e2b67a0 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2962,17 +2962,16 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode, struct vtn_type *type = vtn_value(b, w[1], vtn_value_type_type)->type; unsigned dest_components = glsl_get_vector_elements(type->type); - intrin->num_components = nir_intrinsic_infos[op].dest_components; - if (intrin->num_components == 0) + if (nir_intrinsic_infos[op].dest_components == 0) intrin->num_components = dest_components; nir_ssa_dest_init(&intrin->instr, &intrin->dest, - intrin->num_components, 32, NULL); + nir_intrinsic_dest_components(intrin), 32, NULL); nir_builder_instr_insert(&b->nb, &intrin->instr); nir_ssa_def *result = &intrin->dest.ssa; - if (intrin->num_components != dest_components) + if (nir_intrinsic_dest_components(intrin) != dest_components) result = nir_channels(&b->nb, result, (1 << dest_components) - 1); struct vtn_value *val = diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c index eb255c4106c..8d17845c1a0 100644 --- a/src/compiler/spirv/vtn_subgroup.c +++ b/src/compiler/spirv/vtn_subgroup.c @@ -252,7 +252,8 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode, } nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->nb.shader, op); - intrin->num_components = src0->num_components; + if (nir_intrinsic_infos[op].src_components[0] == 0) + intrin->num_components = src0->num_components; intrin->src[0] = nir_src_for_ssa(src0); nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest, val->type->type, NULL); -- 2.30.2