From a451af9c5194228e2228bcc685d2245a2014eadf Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 20 Aug 2020 23:39:44 +0430 Subject: [PATCH] vkd3d-shader: Properly handle scalar destinations in vkd3d_dxbc_compiler_emit_store(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/spirv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index ea696a2d..c6779633 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3385,6 +3385,16 @@ static void vkd3d_dxbc_compiler_emit_store(struct vkd3d_dxbc_compiler *compiler, assert(write_mask); component_count = vkd3d_write_mask_component_count(write_mask); + dst_component_count = vkd3d_write_mask_component_count(dst_write_mask); + + if (dst_component_count == 1 && component_count != 1) + { + type_id = vkd3d_spirv_get_type_id(builder, component_type, 1); + val_id = vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id, + vkd3d_write_mask_get_component_idx(dst_write_mask)); + write_mask &= dst_write_mask; + component_count = 1; + } if (component_count == 1) { @@ -3392,7 +3402,6 @@ static void vkd3d_dxbc_compiler_emit_store(struct vkd3d_dxbc_compiler *compiler, dst_id, dst_write_mask, component_type, storage_class, write_mask, val_id); } - dst_component_count = vkd3d_write_mask_component_count(dst_write_mask); if (dst_component_count != component_count) { type_id = vkd3d_spirv_get_type_id(builder, component_type, dst_component_count);