From 9e40fe5768cf06b2dab11414979409011e7f9472 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Tue, 28 Sep 2021 16:07:23 +0200 Subject: [PATCH] vkd3d-shader/sm4: Parse the "non-uniform" modifier. Signed-off-by: Conor McCarthy Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/dxbc.c | 6 +++++- libs/vkd3d-shader/sm4.h | 3 +++ libs/vkd3d-shader/trace.c | 9 +++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index f325d9b7..6afb92c5 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -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->precision = VKD3D_SHADER_REGISTER_PRECISION_DEFAULT; + param->non_uniform = false; param->data_type = data_type; *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]; } + if (extended & VKD3D_SM4_REGISTER_NON_UNIFORM_MASK) + param->non_uniform = true; + 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) FIXME("Skipping unhandled extended operand bits 0x%08x.\n", extended); } diff --git a/libs/vkd3d-shader/sm4.h b/libs/vkd3d-shader/sm4.h index e811f198..3ac41cb0 100644 --- a/libs/vkd3d-shader/sm4.h +++ b/libs/vkd3d-shader/sm4.h @@ -104,6 +104,9 @@ #define VKD3D_SM4_REGISTER_PRECISION_SHIFT 14 #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_MASK2 (0x3u << VKD3D_SM4_ADDRESSING_SHIFT2) diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index dba50d2a..45f38d13 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -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); } +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, 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, ¶m->reg); + shader_print_non_uniform(compiler, ¶m->reg); } 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_print_precision(compiler, ¶m->reg); + shader_print_non_uniform(compiler, ¶m->reg); } static void shader_dump_ins_modifiers(struct vkd3d_d3d_asm_compiler *compiler, diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index b48b901f..8b3e7624 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -633,6 +633,7 @@ struct vkd3d_shader_register { enum vkd3d_shader_register_type type; enum vkd3d_shader_register_precision precision; + bool non_uniform; enum vkd3d_data_type data_type; struct vkd3d_shader_register_index idx[3]; enum vkd3d_immconst_type immconst_type;