diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 41b8242825a..e5b2968efa1 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5099,6 +5099,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_CRS */ shader_hw_map2gl, /* WINED3DSIH_CUT */ NULL, /* WINED3DSIH_DCL */ shader_hw_nop, + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_hw_nop, /* WINED3DSIH_DCL_VERTICES_OUT */ shader_hw_nop, /* WINED3DSIH_DEF */ shader_hw_nop, /* WINED3DSIH_DEFB */ shader_hw_nop, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 58fc9acab29..d83371e8c77 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5031,6 +5031,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_CRS */ shader_glsl_cross, /* WINED3DSIH_CUT */ NULL, /* WINED3DSIH_DCL */ shader_glsl_nop, + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_glsl_nop, /* WINED3DSIH_DCL_VERTICES_OUT */ shader_glsl_nop, /* WINED3DSIH_DEF */ shader_glsl_nop, /* WINED3DSIH_DEFB */ shader_glsl_nop, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 5e3abc6ef1f..6941434c5f6 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -50,6 +50,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_CRS */ "crs", /* WINED3DSIH_CUT */ "cut", /* WINED3DSIH_DCL */ "dcl", + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ "dcl_inputPrimitive", /* WINED3DSIH_DCL_VERTICES_OUT */ "dcl_maxOutputVertexCount", /* WINED3DSIH_DEF */ "def", /* WINED3DSIH_DEFB */ "defb", @@ -1241,6 +1242,49 @@ static void shader_dump_ins_modifiers(const struct wined3d_shader_dst_param *dst if (mmask) FIXME("_unrecognized_modifier(%#x)", mmask); } +static void shader_dump_primitive_type(enum wined3d_primitive_type primitive_type) +{ + switch (primitive_type) + { + case WINED3D_PT_UNDEFINED: + TRACE("undefined"); + break; + case WINED3D_PT_POINTLIST: + TRACE("pointlist"); + break; + case WINED3D_PT_LINELIST: + TRACE("linelist"); + break; + case WINED3D_PT_LINESTRIP: + TRACE("linestrip"); + break; + case WINED3D_PT_TRIANGLELIST: + TRACE("trianglelist"); + break; + case WINED3D_PT_TRIANGLESTRIP: + TRACE("trianglestrip"); + break; + case WINED3D_PT_TRIANGLEFAN: + TRACE("trianglefan"); + break; + case WINED3D_PT_LINELIST_ADJ: + TRACE("linelist_adj"); + break; + case WINED3D_PT_LINESTRIP_ADJ: + TRACE("linestrip_adj"); + break; + case WINED3D_PT_TRIANGLELIST_ADJ: + TRACE("trianglelist_adj"); + break; + case WINED3D_PT_TRIANGLESTRIP_ADJ: + TRACE("trianglestrip_adj"); + break; + default: + TRACE("", primitive_type); + break; + } +} + static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *byte_code) { struct wined3d_shader_version shader_version; @@ -1322,6 +1366,11 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe TRACE(" "); shader_dump_dst_param(&ins.declaration.semantic.reg, &shader_version); } + else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE) + { + TRACE("%s ", shader_opcode_names[ins.handler_idx]); + shader_dump_primitive_type(ins.declaration.primitive_type); + } else if (ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT) { TRACE("%s %u", shader_opcode_names[ins.handler_idx], ins.declaration.count); diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 5087849d5a3..2f9094b3edb 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_INSTRUCTION_LENGTH_SHIFT 24 #define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0xf << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) +#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11 +#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT) + #define WINED3D_SM4_OPCODE_MASK 0xff #define WINED3D_SM4_REGISTER_MODIFIER (1 << 31) @@ -98,6 +101,7 @@ enum wined3d_sm4_opcode WINED3D_SM4_OP_USHR = 0x55, WINED3D_SM4_OP_UTOF = 0x56, WINED3D_SM4_OP_XOR = 0x57, + WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE = 0x5d, WINED3D_SM4_OP_DCL_VERTICES_OUT = 0x5e, }; @@ -112,6 +116,15 @@ enum wined3d_sm4_register_type WINED3D_SM4_RT_NULL = 0xd, }; +enum wined3d_sm4_input_primitive_type +{ + WINED3D_SM4_INPUT_PT_POINT = 0x1, + WINED3D_SM4_INPUT_PT_LINE = 0x2, + WINED3D_SM4_INPUT_PT_TRIANGLE = 0x3, + WINED3D_SM4_INPUT_PT_LINEADJ = 0x6, + WINED3D_SM4_INPUT_PT_TRIANGLEADJ = 0x7, +}; + enum wined3d_sm4_immconst_type { WINED3D_SM4_IMMCONST_SCALAR = 0x1, @@ -200,6 +213,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"}, {WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"}, {WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"}, + {WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_INPUT_PRIMITIVE, "", ""}, {WINED3D_SM4_OP_DCL_VERTICES_OUT, WINED3DSIH_DCL_VERTICES_OUT, "", ""}, }; @@ -221,6 +235,18 @@ static const enum wined3d_shader_register_type register_type_table[] = /* WINED3D_SM4_RT_NULL */ WINED3DSPR_NULL, }; +static const enum wined3d_primitive_type input_primitive_type_table[] = +{ + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_INPUT_PT_POINT */ WINED3D_PT_POINTLIST, + /* WINED3D_SM4_INPUT_PT_LINE */ WINED3D_PT_LINELIST, + /* WINED3D_SM4_INPUT_PT_TRIANGLE */ WINED3D_PT_TRIANGLELIST, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_INPUT_PT_LINEADJ */ WINED3D_PT_LINELIST_ADJ, + /* WINED3D_SM4_INPUT_PT_TRIANGLEADJ */ WINED3D_PT_TRIANGLELIST_ADJ, +}; + static const struct sysval_map sysval_map[] = { {WINED3D_SV_DEPTH, WINED3DSPR_DEPTHOUT, 0}, @@ -536,7 +562,22 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi FIXME("Skipping modifier 0x%08x.\n", modifier); } - if (opcode == WINED3D_SM4_OP_DCL_VERTICES_OUT) + if (opcode == WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE) + { + enum wined3d_sm4_input_primitive_type primitive_type; + + primitive_type = (opcode_token & WINED3D_SM4_PRIMITIVE_TYPE_MASK) >> WINED3D_SM4_PRIMITIVE_TYPE_SHIFT; + if (primitive_type >= sizeof(input_primitive_type_table) / sizeof(*input_primitive_type_table)) + { + FIXME("Unhandled input primitive type %#x.\n", primitive_type); + ins->declaration.primitive_type = WINED3D_PT_UNDEFINED; + } + else + { + ins->declaration.primitive_type = input_primitive_type_table[primitive_type]; + } + } + else if (opcode == WINED3D_SM4_OP_DCL_VERTICES_OUT) { ins->declaration.count = *p++; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 31e16cd8fae..1900d4323cf 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -439,6 +439,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_CRS, WINED3DSIH_CUT, WINED3DSIH_DCL, + WINED3DSIH_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_VERTICES_OUT, WINED3DSIH_DEF, WINED3DSIH_DEFB, @@ -667,6 +668,7 @@ struct wined3d_shader_instruction union { struct wined3d_shader_semantic semantic; + enum wined3d_primitive_type primitive_type; UINT count; } declaration; };