Commit 31713e39 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Recognize aoffimmi shader instruction modifier.

The aoffimmi stands for address offset by immediate integer. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a36b4a6a
......@@ -2091,6 +2091,9 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
}
}
if (wined3d_shader_instruction_has_texel_offset(&ins))
shader_addline(&buffer, "(%d,%d,%d)", ins.texel_offset.u, ins.texel_offset.v, ins.texel_offset.w);
for (i = 0; i < ins.dst_count; ++i)
{
shader_dump_ins_modifiers(&buffer, &ins.dst[i]);
......
......@@ -735,6 +735,7 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
ins->dst = &priv->dst_param;
ins->src_count = opcode_info->param_count - opcode_info->dst_count;
ins->src = priv->src_param;
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr;
*ptr += shader_skip_opcode(priv, opcode_info, opcode_token);
......
......@@ -26,6 +26,14 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
#define WINED3D_SM4_INSTRUCTION_MODIFIER (0x1u << 31)
#define WINED3D_SM4_MODIFIER_AOFFIMMI 0x1
#define WINED3D_SM4_AOFFIMMI_U_SHIFT 9
#define WINED3D_SM4_AOFFIMMI_U_MASK (0xfu << WINED3D_SM4_AOFFIMMI_U_SHIFT)
#define WINED3D_SM4_AOFFIMMI_V_SHIFT 13
#define WINED3D_SM4_AOFFIMMI_V_MASK (0xfu << WINED3D_SM4_AOFFIMMI_V_SHIFT)
#define WINED3D_SM4_AOFFIMMI_W_SHIFT 17
#define WINED3D_SM4_AOFFIMMI_W_MASK (0xfu << WINED3D_SM4_AOFFIMMI_W_SHIFT)
#define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24
#define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0x1fu << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
......@@ -853,14 +861,40 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
ins->dst = priv->dst_param;
ins->src_count = strlen(opcode_info->src_info);
ins->src = priv->src_param;
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr;
*ptr += len;
if (opcode_token & WINED3D_SM4_INSTRUCTION_MODIFIER)
{
static const DWORD recognized_bits = WINED3D_SM4_MODIFIER_AOFFIMMI
| WINED3D_SM4_AOFFIMMI_U_MASK
| WINED3D_SM4_AOFFIMMI_V_MASK
| WINED3D_SM4_AOFFIMMI_W_MASK;
DWORD modifier = *p++;
FIXME("Skipping modifier 0x%08x.\n", modifier);
/* Bit fields are used for sign extension */
struct
{
int u : 4;
int v : 4;
int w : 4;
}
aoffimmi;
if (modifier & ~recognized_bits)
{
FIXME("Skipping modifier 0x%08x.\n", modifier);
}
else
{
aoffimmi.u = (modifier & WINED3D_SM4_AOFFIMMI_U_MASK) >> WINED3D_SM4_AOFFIMMI_U_SHIFT;
aoffimmi.v = (modifier & WINED3D_SM4_AOFFIMMI_V_MASK) >> WINED3D_SM4_AOFFIMMI_V_SHIFT;
aoffimmi.w = (modifier & WINED3D_SM4_AOFFIMMI_W_MASK) >> WINED3D_SM4_AOFFIMMI_W_SHIFT;
ins->texel_offset.u = aoffimmi.u;
ins->texel_offset.v = aoffimmi.v;
ins->texel_offset.w = aoffimmi.w;
}
}
if (opcode == WINED3D_SM4_OP_SHADER_DATA)
......
......@@ -801,6 +801,11 @@ struct wined3d_shader_register_semantic
enum wined3d_sysval_semantic sysval_semantic;
};
struct wined3d_shader_texel_offset
{
signed char u, v, w;
};
struct wined3d_shader_instruction
{
const struct wined3d_shader_context *ctx;
......@@ -812,6 +817,7 @@ struct wined3d_shader_instruction
const struct wined3d_shader_dst_param *dst;
UINT src_count;
const struct wined3d_shader_src_param *src;
struct wined3d_shader_texel_offset texel_offset;
union
{
struct wined3d_shader_semantic semantic;
......@@ -824,6 +830,11 @@ struct wined3d_shader_instruction
} declaration;
};
static inline BOOL wined3d_shader_instruction_has_texel_offset(const struct wined3d_shader_instruction *ins)
{
return ins->texel_offset.u || ins->texel_offset.v || ins->texel_offset.w;
}
struct wined3d_shader_attribute
{
enum wined3d_decl_usage usage;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment