Module: vkd3d Branch: master Commit: 0a5fa80f0204e7c757c7c1a9498988175056568f URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/0a5fa80f0204e7c757c7c1a9498988...
Author: Francisco Casas fcasas@codeweavers.com Date: Tue Jul 18 20:21:45 2023 -0400
vkd3d-shader/tpf: Apply mask to swizzle when swizzle type is scalar.
In native's output, for scalar swizzles only the first component of the swizzle is written, the others are left as zero.
---
libs/vkd3d-shader/tpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index b72f4839..21298aba 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3913,8 +3913,13 @@ static void sm4_write_src_register(const struct tpf_writer *tpf, const struct vk token |= reg_dim << VKD3D_SM4_DIMENSION_SHIFT; if (reg_dim == VKD3D_SM4_DIMENSION_VEC4) { - token |= (uint32_t)register_type_info->default_src_swizzle_type << VKD3D_SM4_SWIZZLE_TYPE_SHIFT; - token |= swizzle_to_sm4(src->swizzle) << VKD3D_SM4_SWIZZLE_SHIFT; + uint32_t swizzle_type = (uint32_t)register_type_info->default_src_swizzle_type; + + token |= swizzle_type << VKD3D_SM4_SWIZZLE_TYPE_SHIFT; + if (swizzle_type == VKD3D_SM4_SWIZZLE_SCALAR) + token |= (swizzle_to_sm4(src->swizzle) & 0x3) << VKD3D_SM4_SWIZZLE_SHIFT; + else + token |= swizzle_to_sm4(src->swizzle) << VKD3D_SM4_SWIZZLE_SHIFT; }
switch (src->modifiers)