From a54e397152d299c4911c3b29f653b25d0d86811c Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 6 Jun 2019 10:20:48 -0500 Subject: [PATCH] spirv: Only copy needed components for OpSpecConstantOp Reviewed-by: Karol Herbst --- src/compiler/spirv/spirv_to_nir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index aa3ab303ac4..1e23654e897 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -1940,8 +1940,13 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode, if (!nir_alu_type_get_type_size(nir_op_infos[op].input_types[i])) bit_size = glsl_get_bit_size(src_val->type->type); + unsigned src_comps = nir_op_infos[op].input_sizes[i] ? + nir_op_infos[op].input_sizes[i] : + num_components; + unsigned j = swap ? 1 - i : i; - memcpy(src[j], src_val->constant->values[0], sizeof(src[j])); + for (unsigned c = 0; c < src_comps; c++) + src[j][c] = src_val->constant->values[0][c]; } /* fix up fixed size sources */ -- 2.30.2