vkd3d-shader/tpf: Use vsir_register_init() in shader_sm4_read_param().

This commit is contained in:
Francisco Casas 2023-09-04 18:58:11 -03:00 committed by Alexandre Julliard
parent 6f5cb219f4
commit c1d9e776e2
Notes: Alexandre Julliard 2023-09-26 22:47:43 +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/319

View File

@ -1713,6 +1713,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
enum vkd3d_data_type data_type, struct vkd3d_shader_register *param, enum vkd3d_shader_src_modifier *modifier) enum vkd3d_data_type data_type, struct vkd3d_shader_register *param, enum vkd3d_shader_src_modifier *modifier)
{ {
const struct vkd3d_sm4_register_type_info *register_type_info; const struct vkd3d_sm4_register_type_info *register_type_info;
enum vkd3d_shader_register_type vsir_register_type;
enum vkd3d_sm4_register_precision precision; enum vkd3d_sm4_register_precision precision;
enum vkd3d_sm4_register_type register_type; enum vkd3d_sm4_register_type register_type;
enum vkd3d_sm4_extended_operand_type type; enum vkd3d_sm4_extended_operand_type type;
@ -1731,15 +1732,18 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
if (!register_type_info) if (!register_type_info)
{ {
FIXME("Unhandled register type %#x.\n", register_type); FIXME("Unhandled register type %#x.\n", register_type);
param->type = VKD3DSPR_TEMP; vsir_register_type = VKD3DSPR_TEMP;
} }
else else
{ {
param->type = register_type_info->vkd3d_type; vsir_register_type = register_type_info->vkd3d_type;
} }
order = (token & VKD3D_SM4_REGISTER_ORDER_MASK) >> VKD3D_SM4_REGISTER_ORDER_SHIFT;
vsir_register_init(param, vsir_register_type, data_type, order);
param->precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT; param->precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT;
param->non_uniform = false; param->non_uniform = false;
param->data_type = data_type;
*modifier = VKD3DSPSM_NONE; *modifier = VKD3DSPSM_NONE;
if (token & VKD3D_SM4_EXTENDED_OPERAND) if (token & VKD3D_SM4_EXTENDED_OPERAND)
@ -1809,14 +1813,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
} }
} }
order = (token & VKD3D_SM4_REGISTER_ORDER_MASK) >> VKD3D_SM4_REGISTER_ORDER_SHIFT; if (order >= 1)
if (order < 1)
{
param->idx[0].offset = ~0u;
param->idx[0].rel_addr = NULL;
}
else
{ {
DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK0) >> VKD3D_SM4_ADDRESSING_SHIFT0; DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK0) >> VKD3D_SM4_ADDRESSING_SHIFT0;
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[0]))) if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[0])))
@ -1826,12 +1823,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
} }
} }
if (order < 2) if (order >= 2)
{
param->idx[1].offset = ~0u;
param->idx[1].rel_addr = NULL;
}
else
{ {
DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK1) >> VKD3D_SM4_ADDRESSING_SHIFT1; DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK1) >> VKD3D_SM4_ADDRESSING_SHIFT1;
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[1]))) if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[1])))
@ -1841,12 +1833,7 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
} }
} }
if (order < 3) if (order >= 3)
{
param->idx[2].offset = ~0u;
param->idx[2].rel_addr = NULL;
}
else
{ {
DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK2) >> VKD3D_SM4_ADDRESSING_SHIFT2; DWORD addressing = (token & VKD3D_SM4_ADDRESSING_MASK2) >> VKD3D_SM4_ADDRESSING_SHIFT2;
if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[2]))) if (!(shader_sm4_read_reg_idx(priv, ptr, end, addressing, &param->idx[2])))
@ -1862,8 +1849,6 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
return false; return false;
} }
param->idx_count = order;
if (register_type == VKD3D_SM4_RT_IMMCONST || register_type == VKD3D_SM4_RT_IMMCONST64) if (register_type == VKD3D_SM4_RT_IMMCONST || register_type == VKD3D_SM4_RT_IMMCONST64)
{ {
enum vkd3d_sm4_dimension dimension = (token & VKD3D_SM4_DIMENSION_MASK) >> VKD3D_SM4_DIMENSION_SHIFT; enum vkd3d_sm4_dimension dimension = (token & VKD3D_SM4_DIMENSION_MASK) >> VKD3D_SM4_DIMENSION_SHIFT;