vkd3d-shader/tpf: Use the default vec4 swizzle if a src param contains a mask.

This commit is contained in:
Conor McCarthy 2023-08-08 12:09:10 +10:00 committed by Alexandre Julliard
parent 7e5d9e3b6f
commit 92021b7a3c
Notes: Alexandre Julliard 2023-08-28 22:16:25 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/225
3 changed files with 25 additions and 11 deletions

View File

@ -204,11 +204,6 @@ static inline bool register_is_undef(const struct vkd3d_shader_register *reg)
return reg->type == VKD3DSPR_UNDEF;
}
static inline bool register_is_constant(const struct vkd3d_shader_register *reg)
{
return (reg->type == VKD3DSPR_IMMCONST || reg->type == VKD3DSPR_IMMCONST64);
}
static inline bool register_is_constant_or_undef(const struct vkd3d_shader_register *reg)
{
return register_is_constant(reg) || register_is_undef(reg);

View File

@ -507,7 +507,7 @@ enum vkd3d_sm4_input_primitive_type
enum vkd3d_sm4_swizzle_type
{
VKD3D_SM4_SWIZZLE_NONE = 0x0,
VKD3D_SM4_SWIZZLE_NONE = 0x0, /* swizzle bitfield contains a mask */
VKD3D_SM4_SWIZZLE_VEC4 = 0x1,
VKD3D_SM4_SWIZZLE_SCALAR = 0x2,
};
@ -2026,7 +2026,7 @@ static bool shader_sm4_validate_input_output_register(struct vkd3d_shader_sm4_pa
static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, const uint32_t **ptr,
const uint32_t *end, enum vkd3d_data_type data_type, struct vkd3d_shader_src_param *src_param)
{
unsigned int dimension;
unsigned int dimension, mask;
DWORD token;
if (*ptr >= end)
@ -2057,10 +2057,23 @@ static bool shader_sm4_read_src_param(struct vkd3d_shader_sm4_parser *priv, cons
switch (swizzle_type)
{
case VKD3D_SM4_SWIZZLE_NONE:
if (shader_sm4_is_scalar_register(&src_param->reg))
src_param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X);
else
src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE;
mask = (token & VKD3D_SM4_WRITEMASK_MASK) >> VKD3D_SM4_WRITEMASK_SHIFT;
/* Mask seems only to be used for vec4 constants and is always zero. */
if (!register_is_constant(&src_param->reg))
{
FIXME("Source mask %#x is not for a constant.\n", mask);
vkd3d_shader_parser_warning(&priv->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK,
"Unhandled mask %#x for a non-constant source register.", mask);
}
else if (mask)
{
FIXME("Unhandled mask %#x.\n", mask);
vkd3d_shader_parser_warning(&priv->p, VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK,
"Unhandled source register mask %#x.", mask);
}
break;
case VKD3D_SM4_SWIZZLE_SCALAR:

View File

@ -84,6 +84,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_WARNING_TPF_MASK_NOT_CONTIGUOUS = 1300,
VKD3D_SHADER_WARNING_TPF_UNHANDLED_INDEX_RANGE_MASK = 1301,
VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK = 1302,
VKD3D_SHADER_ERROR_SPV_DESCRIPTOR_BINDING_NOT_FOUND = 2000,
VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE = 2001,
@ -1018,6 +1019,11 @@ static inline bool vkd3d_shader_register_is_patch_constant(const struct vkd3d_sh
return reg->type == VKD3DSPR_PATCHCONST;
}
static inline bool register_is_constant(const struct vkd3d_shader_register *reg)
{
return (reg->type == VKD3DSPR_IMMCONST || reg->type == VKD3DSPR_IMMCONST64);
}
struct vkd3d_shader_location
{
const char *source_name;