vkd3d-shader: Do not assume vec4 destination in vkd3d_dxbc_compiler_emit_store().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-02-25 11:59:13 +01:00 committed by Alexandre Julliard
parent 95b6d5222d
commit 04e2091afa
1 changed files with 5 additions and 4 deletions

View File

@ -2932,8 +2932,8 @@ static void vkd3d_dxbc_compiler_emit_store(struct vkd3d_dxbc_compiler *compiler,
SpvStorageClass storage_class, unsigned int write_mask, uint32_t val_id)
{
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
unsigned int component_count, dst_component_count;
uint32_t type_id, dst_val_id;
unsigned int component_count;
assert(write_mask);
@ -2945,13 +2945,14 @@ 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);
}
if (component_count != VKD3D_VEC4_SIZE)
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, VKD3D_VEC4_SIZE);
type_id = vkd3d_spirv_get_type_id(builder, component_type, dst_component_count);
dst_val_id = vkd3d_spirv_build_op_load(builder, type_id, dst_id, SpvMemoryAccessMaskNone);
val_id = vkd3d_dxbc_compiler_emit_vector_shuffle(compiler,
dst_val_id, val_id, write_mask, component_type, VKD3D_VEC4_SIZE);
dst_val_id, val_id, write_mask, component_type, dst_component_count);
}
vkd3d_spirv_build_op_store(builder, dst_id, val_id, SpvMemoryAccessMaskNone);