From 2037daae3221de0713c0c049d3c6fbbe53216340 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Tue, 5 Dec 2023 14:36:22 +1000 Subject: [PATCH] vkd3d-shader/spirv: Bitcast if necessary in the spirv_compiler_emit_mov() general implementation. In SM 6, this is needed when storing an asfloat() or asuint() result in an indexable temp, because dxc performs the bitcast by casting the destination pointer. --- libs/vkd3d-shader/spirv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 4624def6..a60246fd 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -6926,6 +6926,11 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler, general_implementation: val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask); + if (dst->reg.data_type != src->reg.data_type) + { + val_id = vkd3d_spirv_build_op_bitcast(builder, vkd3d_spirv_get_type_id_for_data_type(builder, + dst->reg.data_type, vkd3d_write_mask_component_count(dst->write_mask)), val_id); + } spirv_compiler_emit_store_dst(compiler, dst, val_id); }