summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-06-06 10:20:48 -0500
committerJason Ekstrand <[email protected]>2019-06-19 21:05:54 +0000
commita54e397152d299c4911c3b29f653b25d0d86811c (patch)
treea467d5de2c715e1fa8a5e385f85ff65a6317b97b /src/compiler/spirv
parent96bb9c9277383ddcd5920d066bdfec4aa009d733 (diff)
spirv: Only copy needed components for OpSpecConstantOp
Reviewed-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c7
1 files changed, 6 insertions, 1 deletions
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 */