Module: vkd3d Branch: master Commit: 5082893e5d06760a4fa3187d8db6091638604107 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/5082893e5d06760a4fa3187d8db609...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Tue Feb 27 17:48:36 2024 +1000
vkd3d-shader/spirv: Always use a 64-bit write mask for IMMCONST64 src params.
There is no way to tell in spirv_compiler_emit_load_reg() if the write mask is 64-bit. All loads are 32-bit except for IMMCONST64 and SSA, and the latter ignores the mask, so the only issue lies with IMMCONST64.
---
libs/vkd3d-shader/spirv.c | 6 ++++-- tests/hlsl/uav-rwbyteaddressbuffer.shader_test | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 6b5f54fe..c0cbdccf 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -7093,8 +7093,8 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler, struct vkd3d_shader_register_info dst_reg_info, src_reg_info; const struct vkd3d_shader_dst_param *dst = instruction->dst; const struct vkd3d_shader_src_param *src = instruction->src; + unsigned int i, component_count, write_mask; uint32_t components[VKD3D_VEC4_SIZE]; - unsigned int i, component_count;
if (register_is_constant_or_undef(&src->reg) || src->reg.type == VKD3DSPR_SSA || dst->reg.type == VKD3DSPR_SSA || dst->modifiers || src->modifiers) @@ -7145,7 +7145,9 @@ static void spirv_compiler_emit_mov(struct spirv_compiler *compiler, }
general_implementation: - val_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask); + write_mask = (src->reg.type == VKD3DSPR_IMMCONST64 && !data_type_is_64_bit(dst->reg.data_type)) + ? vsir_write_mask_64_from_32(dst->write_mask) : dst->write_mask; + val_id = spirv_compiler_emit_load_src(compiler, src, 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, diff --git a/tests/hlsl/uav-rwbyteaddressbuffer.shader_test b/tests/hlsl/uav-rwbyteaddressbuffer.shader_test index 056f94f6..556d0fb3 100644 --- a/tests/hlsl/uav-rwbyteaddressbuffer.shader_test +++ b/tests/hlsl/uav-rwbyteaddressbuffer.shader_test @@ -34,7 +34,7 @@ float4 main() : sv_target }
[test] -todo draw quad +todo(sm<6) draw quad if(sm<6) probe uav 1 (0) ri (12) if(sm>=6) probe uav 1 (0) rd (12.2)
@@ -54,6 +54,6 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe uav 1 (0) ri64 (-12) probe uav 1 (1) rd (13.3)