From: Jason Ekstrand Date: Thu, 6 Jun 2019 15:20:48 +0000 (-0500) Subject: spirv: Only copy needed components for OpSpecConstantOp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a54e397152d299c4911c3b29f653b25d0d86811c;p=mesa.git spirv: Only copy needed components for OpSpecConstantOp Reviewed-by: Karol Herbst --- 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 */