vkd3d-shader/spirv: Bitcast if necessary in spirv_compiler_emit_store_dst_components().

This commit is contained in:
Conor McCarthy 2024-03-01 13:22:49 +10:00 committed by Alexandre Julliard
parent 85c8c6be4d
commit dc99159dd8
Notes: Alexandre Julliard 2024-04-09 15:45:14 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/750

View File

@ -4419,11 +4419,11 @@ static void spirv_compiler_emit_store_dst_components(struct spirv_compiler *comp
{ {
unsigned int component_count = vsir_write_mask_component_count(dst->write_mask); unsigned int component_count = vsir_write_mask_component_count(dst->write_mask);
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
uint32_t type_id, val_id; uint32_t type_id, dst_type_id, val_id;
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
if (component_count > 1) if (component_count > 1)
{ {
type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
val_id = vkd3d_spirv_build_op_composite_construct(builder, val_id = vkd3d_spirv_build_op_composite_construct(builder,
type_id, component_ids, component_count); type_id, component_ids, component_count);
} }
@ -4431,6 +4431,11 @@ static void spirv_compiler_emit_store_dst_components(struct spirv_compiler *comp
{ {
val_id = *component_ids; val_id = *component_ids;
} }
dst_type_id = vkd3d_spirv_get_type_id_for_data_type(builder, dst->reg.data_type, component_count);
if (dst_type_id != type_id)
val_id = vkd3d_spirv_build_op_bitcast(builder, dst_type_id, val_id);
spirv_compiler_emit_store_dst(compiler, dst, val_id); spirv_compiler_emit_store_dst(compiler, dst, val_id);
} }