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.
This commit is contained in:
Francisco Casas 2023-07-18 20:21:45 -04:00 committed by Alexandre Julliard
parent f06169afc5
commit 0a5fa80f02
Notes: Alexandre Julliard 2023-10-05 22:38:01 +02: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/387

View File

@ -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)