wined3d: Recognize SM4 dcl_input_ps_sgv opcode.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-02-02 11:32:29 +01:00 committed by Alexandre Julliard
parent 0de89fd1bf
commit e02f6ebf91
6 changed files with 58 additions and 0 deletions

View File

@ -5231,6 +5231,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_DCL_INPUT */ NULL,
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_hw_nop,
/* WINED3DSIH_DCL_INPUT_PS */ NULL,
/* WINED3DSIH_DCL_INPUT_PS_SGV */ NULL,
/* WINED3DSIH_DCL_OUTPUT */ NULL,
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_hw_nop,
/* WINED3DSIH_DCL_SAMPLER */ NULL,

View File

@ -8019,6 +8019,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_DCL_INPUT */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_glsl_nop,
/* WINED3DSIH_DCL_INPUT_PS */ NULL,
/* WINED3DSIH_DCL_INPUT_PS_SGV */ NULL,
/* WINED3DSIH_DCL_OUTPUT */ shader_glsl_nop,
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_glsl_nop,
/* WINED3DSIH_DCL_SAMPLER */ NULL,

View File

@ -59,6 +59,7 @@ static const char * const shader_opcode_names[] =
/* WINED3DSIH_DCL_INPUT */ "dcl_input",
/* WINED3DSIH_DCL_INPUT_PRIMITIVE */ "dcl_inputPrimitive",
/* WINED3DSIH_DCL_INPUT_PS */ "dcl_input_ps",
/* WINED3DSIH_DCL_INPUT_PS_SGV */ "dcl_input_ps_sgv",
/* WINED3DSIH_DCL_OUTPUT */ "dcl_output",
/* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ "dcl_outputTopology",
/* WINED3DSIH_DCL_SAMPLER */ "dcl_sampler",
@ -195,6 +196,20 @@ static const char * const semantic_names[] =
/* WINED3D_DECL_USAGE_SAMPLE */ "SAMPLE",
};
static const struct
{
enum wined3d_sysval_semantic sysval_semantic;
const char *sysval_name;
}
sysval_semantic_names[] =
{
{WINED3D_SV_POSITION, "SV_Position"},
{WINED3D_SV_INSTANCEID, "SV_InstanceID"},
{WINED3D_SV_PRIMITIVEID, "SV_PrimitiveID"},
{WINED3D_SV_ISFRONTFACE, "SV_IsFrontFace"},
{WINED3D_SV_SAMPLEINDEX, "SV_SampleIndex"},
};
const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx)
{
if (handler_idx >= sizeof(shader_opcode_names) / sizeof(*shader_opcode_names))
@ -1210,6 +1225,22 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map
return wined3d_log2i(map);
}
static void shader_dump_sysval_semantic(enum wined3d_sysval_semantic semantic)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(sysval_semantic_names); ++i)
{
if (sysval_semantic_names[i].sysval_semantic == semantic)
{
TRACE("%s", sysval_semantic_names[i].sysval_name);
return;
}
}
TRACE("unknown_sysval_semantic(%#x)", semantic);
}
static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semantic,
const struct wined3d_shader_version *shader_version)
{
@ -1884,6 +1915,13 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
TRACE(" ");
shader_dump_dst_param(&ins.declaration.dst, &shader_version);
}
else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PS_SGV)
{
TRACE("%s ", shader_opcode_names[ins.handler_idx]);
shader_dump_dst_param(&ins.declaration.register_semantic.reg, &shader_version);
TRACE(", ");
shader_dump_sysval_semantic(ins.declaration.register_semantic.sysval_semantic);
}
else if (ins.handler_idx == WINED3DSIH_DCL_INPUT
|| ins.handler_idx == WINED3DSIH_DCL_OUTPUT)
{

View File

@ -163,6 +163,7 @@ enum wined3d_sm4_opcode
WINED3D_SM4_OP_DCL_VERTICES_OUT = 0x5e,
WINED3D_SM4_OP_DCL_INPUT = 0x5f,
WINED3D_SM4_OP_DCL_INPUT_PS = 0x62,
WINED3D_SM4_OP_DCL_INPUT_PS_SGV = 0x63,
WINED3D_SM4_OP_DCL_OUTPUT = 0x65,
WINED3D_SM4_OP_DCL_TEMPS = 0x68,
};
@ -368,6 +369,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
{WINED3D_SM4_OP_DCL_VERTICES_OUT, WINED3DSIH_DCL_VERTICES_OUT, "", ""},
{WINED3D_SM4_OP_DCL_INPUT, WINED3DSIH_DCL_INPUT, "", ""},
{WINED3D_SM4_OP_DCL_INPUT_PS, WINED3DSIH_DCL_INPUT_PS, "", ""},
{WINED3D_SM4_OP_DCL_INPUT_PS_SGV, WINED3DSIH_DCL_INPUT_PS_SGV, "", ""},
{WINED3D_SM4_OP_DCL_OUTPUT, WINED3DSIH_DCL_OUTPUT, "", ""},
{WINED3D_SM4_OP_DCL_TEMPS, WINED3DSIH_DCL_TEMPS, "", ""},
};
@ -985,6 +987,11 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.dst);
}
else if (opcode == WINED3D_SM4_OP_DCL_INPUT_PS_SGV)
{
shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.register_semantic.reg);
ins->declaration.register_semantic.sysval_semantic = *p++;
}
else if (opcode == WINED3D_SM4_OP_DCL_INPUT
|| opcode == WINED3D_SM4_OP_DCL_OUTPUT)
{

View File

@ -503,6 +503,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER
WINED3DSIH_DCL_INPUT,
WINED3DSIH_DCL_INPUT_PRIMITIVE,
WINED3DSIH_DCL_INPUT_PS,
WINED3DSIH_DCL_INPUT_PS_SGV,
WINED3DSIH_DCL_OUTPUT,
WINED3DSIH_DCL_OUTPUT_TOPOLOGY,
WINED3DSIH_DCL_SAMPLER,
@ -781,6 +782,12 @@ struct wined3d_shader_semantic
struct wined3d_shader_dst_param reg;
};
struct wined3d_shader_register_semantic
{
struct wined3d_shader_dst_param reg;
enum wined3d_sysval_semantic sysval_semantic;
};
struct wined3d_shader_instruction
{
const struct wined3d_shader_context *ctx;
@ -795,6 +802,7 @@ struct wined3d_shader_instruction
union
{
struct wined3d_shader_semantic semantic;
struct wined3d_shader_register_semantic register_semantic;
enum wined3d_primitive_type primitive_type;
struct wined3d_shader_dst_param dst;
struct wined3d_shader_src_param src;

View File

@ -741,7 +741,10 @@ enum wined3d_decl_usage
enum wined3d_sysval_semantic
{
WINED3D_SV_POSITION = 1,
WINED3D_SV_PRIMITIVEID = 7,
WINED3D_SV_INSTANCEID = 8,
WINED3D_SV_ISFRONTFACE = 9,
WINED3D_SV_SAMPLEINDEX = 10,
WINED3D_SV_DEPTH = 0xffffffff,
WINED3D_SV_TARGET0 = 0,