diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 0c2ede1ce7a..4b9c44547c9 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -956,14 +956,27 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, } else if (reg->type != WINED3DSPR_RASTOUT && reg->type != WINED3DSPR_MISCTYPE) { - if (reg->rel_addr) + if (reg->array_idx != ~0U) { - TRACE("["); - shader_dump_src_param(reg->rel_addr, shader_version); - TRACE(" + "); + TRACE("%u[%u", offset, reg->array_idx); + if (reg->rel_addr) + { + TRACE(" + "); + shader_dump_src_param(reg->rel_addr, shader_version); + } + TRACE("]"); + } + else + { + if (reg->rel_addr) + { + TRACE("["); + shader_dump_src_param(reg->rel_addr, shader_version); + TRACE(" + "); + } + TRACE("%u", offset); + if (reg->rel_addr) TRACE("]"); } - TRACE("%u", offset); - if (reg->rel_addr) TRACE("]"); } } diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c index a626d52a763..ead2769e34c 100644 --- a/dlls/wined3d/shader_sm1.c +++ b/dlls/wined3d/shader_sm1.c @@ -349,6 +349,7 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_ src->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); src->reg.idx = param & WINED3DSP_REGNUM_MASK; + src->reg.array_idx = ~0U; src->swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT; src->modifiers = (param & WINED3DSP_SRCMOD_MASK) >> WINED3DSP_SRCMOD_SHIFT; src->reg.rel_addr = rel_addr; @@ -360,6 +361,7 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_ dst->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); dst->reg.idx = param & WINED3DSP_REGNUM_MASK; + dst->reg.array_idx = ~0U; dst->write_mask = (param & WINED3D_SM1_WRITEMASK_MASK) >> WINED3D_SM1_WRITEMASK_SHIFT; dst->modifiers = (param & WINED3DSP_DSTMOD_MASK) >> WINED3DSP_DSTMOD_SHIFT; dst->shift = (param & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT; diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 5cc445db69a..57a365b212f 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -28,6 +28,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); #define WINED3D_SM4_OPCODE_MASK 0xff +#define WINED3D_SM4_REGISTER_ORDER_SHIFT 20 +#define WINED3D_SM4_REGISTER_ORDER_MASK (0x3 << WINED3D_SM4_REGISTER_ORDER_SHIFT) + #define WINED3D_SM4_REGISTER_TYPE_SHIFT 12 #define WINED3D_SM4_REGISTER_TYPE_MASK (0xf << WINED3D_SM4_REGISTER_TYPE_SHIFT) @@ -265,6 +268,7 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine struct wined3d_sm4_data *priv = data; DWORD token = *(*ptr)++; enum wined3d_sm4_register_type register_type; + DWORD order; register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT; if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) @@ -277,6 +281,16 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine src_param->reg.type = register_type_table[register_type]; } + order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; + + if (order < 1) src_param->reg.idx = ~0U; + else src_param->reg.idx = *(*ptr)++; + + if (order < 2) src_param->reg.array_idx = ~0U; + else src_param->reg.array_idx = *(*ptr)++; + + if (order > 2) FIXME("Unhandled order %u.\n", order); + if (register_type == WINED3D_SM4_RT_IMMCONST) { enum wined3d_sm4_immconst_type immconst_type = @@ -304,7 +318,6 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine } else { - src_param->reg.idx = *(*ptr)++; src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; } @@ -319,8 +332,8 @@ static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wine { struct wined3d_sm4_data *priv = data; DWORD token = *(*ptr)++; - UINT register_idx = *(*ptr)++; enum wined3d_sm4_register_type register_type; + DWORD order; register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT; if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) @@ -333,7 +346,16 @@ static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wine dst_param->reg.type = register_type_table[register_type]; } - dst_param->reg.idx = register_idx; + order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; + + if (order < 1) dst_param->reg.idx = ~0U; + else dst_param->reg.idx = *(*ptr)++; + + if (order < 2) dst_param->reg.array_idx = ~0U; + else dst_param->reg.array_idx = *(*ptr)++; + + if (order > 2) FIXME("Unhandled order %u.\n", order); + dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT; dst_param->modifiers = 0; dst_param->shift = 0; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 68f2e4c3a8c..1e9aa9364dd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -670,6 +670,7 @@ struct wined3d_shader_register { WINED3DSHADER_PARAM_REGISTER_TYPE type; UINT idx; + UINT array_idx; const struct wined3d_shader_src_param *rel_addr; enum wined3d_immconst_type immconst_type; DWORD immconst_data[4];