vkd3d-shader/sm4: Parse the "non-uniform" modifier.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Conor McCarthy 2021-09-28 16:07:23 +02:00 committed by Alexandre Julliard
parent a422e37953
commit 9e40fe5768
4 changed files with 18 additions and 1 deletions

View File

@ -1200,6 +1200,7 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
param->type = register_type_table[register_type]; param->type = register_type_table[register_type];
} }
param->precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT; param->precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT;
param->non_uniform = false;
param->data_type = data_type; param->data_type = data_type;
*modifier = VKD3DSPSM_NONE; *modifier = VKD3DSPSM_NONE;
@ -1249,8 +1250,11 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr
param->precision = register_precision_table[precision]; param->precision = register_precision_table[precision];
} }
if (extended & VKD3D_SM4_REGISTER_NON_UNIFORM_MASK)
param->non_uniform = true;
extended &= ~(VKD3D_SM4_EXTENDED_OPERAND_TYPE_MASK | VKD3D_SM4_REGISTER_MODIFIER_MASK extended &= ~(VKD3D_SM4_EXTENDED_OPERAND_TYPE_MASK | VKD3D_SM4_REGISTER_MODIFIER_MASK
| VKD3D_SM4_REGISTER_PRECISION_MASK); | VKD3D_SM4_REGISTER_PRECISION_MASK | VKD3D_SM4_REGISTER_NON_UNIFORM_MASK);
if (extended) if (extended)
FIXME("Skipping unhandled extended operand bits 0x%08x.\n", extended); FIXME("Skipping unhandled extended operand bits 0x%08x.\n", extended);
} }

View File

@ -104,6 +104,9 @@
#define VKD3D_SM4_REGISTER_PRECISION_SHIFT 14 #define VKD3D_SM4_REGISTER_PRECISION_SHIFT 14
#define VKD3D_SM4_REGISTER_PRECISION_MASK (0x7u << VKD3D_SM4_REGISTER_PRECISION_SHIFT) #define VKD3D_SM4_REGISTER_PRECISION_MASK (0x7u << VKD3D_SM4_REGISTER_PRECISION_SHIFT)
#define VKD3D_SM4_REGISTER_NON_UNIFORM_SHIFT 17
#define VKD3D_SM4_REGISTER_NON_UNIFORM_MASK (0x1u << VKD3D_SM4_REGISTER_NON_UNIFORM_SHIFT)
#define VKD3D_SM4_ADDRESSING_SHIFT2 28 #define VKD3D_SM4_ADDRESSING_SHIFT2 28
#define VKD3D_SM4_ADDRESSING_MASK2 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT2) #define VKD3D_SM4_ADDRESSING_MASK2 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT2)

View File

@ -1202,6 +1202,13 @@ static void shader_print_precision(struct vkd3d_d3d_asm_compiler *compiler, cons
vkd3d_string_buffer_printf(buffer, " {%s%s%s}", compiler->colours.modifier, precision, compiler->colours.reset); vkd3d_string_buffer_printf(buffer, " {%s%s%s}", compiler->colours.modifier, precision, compiler->colours.reset);
} }
static void shader_print_non_uniform(struct vkd3d_d3d_asm_compiler *compiler, const struct vkd3d_shader_register *reg)
{
if (reg->non_uniform)
vkd3d_string_buffer_printf(&compiler->buffer, " {%snonuniform%s}",
compiler->colours.modifier, compiler->colours.reset);
}
static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler, static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler,
const struct vkd3d_shader_dst_param *param, bool is_declaration) const struct vkd3d_shader_dst_param *param, bool is_declaration)
{ {
@ -1230,6 +1237,7 @@ static void shader_dump_dst_param(struct vkd3d_d3d_asm_compiler *compiler,
} }
shader_print_precision(compiler, &param->reg); shader_print_precision(compiler, &param->reg);
shader_print_non_uniform(compiler, &param->reg);
} }
static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler, static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
@ -1302,6 +1310,7 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
shader_addline(buffer, "|"); shader_addline(buffer, "|");
shader_print_precision(compiler, &param->reg); shader_print_precision(compiler, &param->reg);
shader_print_non_uniform(compiler, &param->reg);
} }
static void shader_dump_ins_modifiers(struct vkd3d_d3d_asm_compiler *compiler, static void shader_dump_ins_modifiers(struct vkd3d_d3d_asm_compiler *compiler,

View File

@ -633,6 +633,7 @@ struct vkd3d_shader_register
{ {
enum vkd3d_shader_register_type type; enum vkd3d_shader_register_type type;
enum vkd3d_shader_register_precision precision; enum vkd3d_shader_register_precision precision;
bool non_uniform;
enum vkd3d_data_type data_type; enum vkd3d_data_type data_type;
struct vkd3d_shader_register_index idx[3]; struct vkd3d_shader_register_index idx[3];
enum vkd3d_immconst_type immconst_type; enum vkd3d_immconst_type immconst_type;