From 90dcb4db72fed08d1f521ce8eb31c09c4ed79fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 1 Apr 2016 11:21:38 +0200 Subject: [PATCH] wined3d: Recognize SM5 dcl_tessellator_output_primitive opcode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/arb_program_shader.c | 1 + dlls/wined3d/glsl_shader.c | 1 + dlls/wined3d/shader.c | 29 +++++++++++++++++++++++++++++ dlls/wined3d/shader_sm4.c | 15 +++++++++++---- dlls/wined3d/wined3d_private.h | 10 ++++++++++ 5 files changed, 52 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 1cb4d205a47..33746af53f3 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5249,6 +5249,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_DCL_SAMPLER */ NULL, /* WINED3DSIH_DCL_TEMPS */ NULL, /* WINED3DSIH_DCL_TESSELLATOR_DOMAIN */ NULL, + /* WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE */ NULL, /* WINED3DSIH_DCL_UAV_TYPED */ NULL, /* WINED3DSIH_DCL_VERTICES_OUT */ shader_hw_nop, /* WINED3DSIH_DEF */ shader_hw_nop, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index ce1b1f4d1b4..89f5b5e4976 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -8163,6 +8163,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_DCL_SAMPLER */ shader_glsl_nop, /* WINED3DSIH_DCL_TEMPS */ shader_glsl_nop, /* WINED3DSIH_DCL_TESSELLATOR_DOMAIN */ NULL, + /* WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE */ NULL, /* WINED3DSIH_DCL_UAV_TYPED */ NULL, /* WINED3DSIH_DCL_VERTICES_OUT */ shader_glsl_nop, /* WINED3DSIH_DEF */ shader_glsl_nop, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index ec45dd88a57..4e1a617e30d 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -75,6 +75,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_DCL_SAMPLER */ "dcl_sampler", /* WINED3DSIH_DCL_TEMPS */ "dcl_temps", /* WINED3DSIH_DCL_TESSELLATOR_DOMAIN */ "dcl_tessellator_domain", + /* WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE */ "dcl_tessellator_output_primitive", /* WINED3DSIH_DCL_UAV_TYPED */ "dcl_uav_typed", /* WINED3DSIH_DCL_VERTICES_OUT */ "dcl_maxOutputVertexCount", /* WINED3DSIH_DEF */ "def", @@ -1318,6 +1319,29 @@ static void shader_dump_tessellator_domain(struct wined3d_string_buffer *buffer, } } +static void shader_dump_tessellator_output_primitive(struct wined3d_string_buffer *buffer, + enum wined3d_tessellator_output_primitive output_primitive) +{ + switch (output_primitive) + { + case WINED3D_TESSELLATOR_OUTPUT_POINT: + shader_addline(buffer, "point"); + break; + case WINED3D_TESSELLATOR_OUTPUT_LINE: + shader_addline(buffer, "line"); + break; + case WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CW: + shader_addline(buffer, "triangle_cw"); + break; + case WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW: + shader_addline(buffer, "triangle_ccw"); + break; + default: + shader_addline(buffer, "unknown_tessellator_output_primitive(%#x)", output_primitive); + break; + } +} + static void shader_dump_sysval_semantic(struct wined3d_string_buffer *buffer, enum wined3d_sysval_semantic semantic) { unsigned int i; @@ -2119,6 +2143,11 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]); shader_dump_tessellator_domain(&buffer, ins.declaration.tessellator_domain); } + else if (ins.handler_idx == WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE) + { + shader_addline(&buffer, "%s ", shader_opcode_names[ins.handler_idx]); + shader_dump_tessellator_output_primitive(&buffer, ins.declaration.tessellator_output_primitive); + } else if (ins.handler_idx == WINED3DSIH_DEF) { shader_addline(&buffer, "def c%u = %.8e, %.8e, %.8e, %.8e", shader_get_float_offset(ins.dst[0].reg.type, diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 936b84b3902..515061b7d77 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -64,8 +64,8 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode); #define WINED3D_SM5_CONTROL_POINT_COUNT_SHIFT 11 #define WINED3D_SM5_CONTROL_POINT_COUNT_MASK (0xffu << WINED3D_SM5_CONTROL_POINT_COUNT_SHIFT) -#define WINED3D_SM5_TESSELLATOR_DOMAIN_SHIFT 11 -#define WINED3D_SM5_TESSELLATOR_DOMAIN_MASK (0xfu << WINED3D_SM5_TESSELLATOR_DOMAIN_SHIFT) +#define WINED3D_SM5_TESSELLATOR_SHIFT 11 +#define WINED3D_SM5_TESSELLATOR_MASK (0xfu << WINED3D_SM5_TESSELLATOR_SHIFT) #define WINED3D_SM4_OPCODE_MASK 0xff @@ -199,6 +199,7 @@ enum wined3d_sm4_opcode WINED3D_SM5_OP_DCL_INPUT_CONTROL_POINT_COUNT = 0x93, WINED3D_SM5_OP_DCL_OUTPUT_CONTROL_POINT_COUNT = 0x94, WINED3D_SM5_OP_DCL_TESSELLATOR_DOMAIN = 0x95, + WINED3D_SM5_OP_DCL_TESSELLATOR_OUTPUT_PRIMITIVE = 0x97, WINED3D_SM5_OP_DCL_HS_MAX_TESSFACTOR = 0x98, WINED3D_SM5_OP_DCL_HS_FORK_PHASE_INSTANCE_COUNT = 0x99, WINED3D_SM5_OP_DCL_UAV_TYPED = 0x9c, @@ -419,6 +420,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {WINED3D_SM5_OP_DCL_INPUT_CONTROL_POINT_COUNT, WINED3DSIH_DCL_INPUT_CONTROL_POINT_COUNT, "", ""}, {WINED3D_SM5_OP_DCL_OUTPUT_CONTROL_POINT_COUNT, WINED3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT, "", ""}, {WINED3D_SM5_OP_DCL_TESSELLATOR_DOMAIN, WINED3DSIH_DCL_TESSELLATOR_DOMAIN, "", ""}, + {WINED3D_SM5_OP_DCL_TESSELLATOR_OUTPUT_PRIMITIVE, WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE, "", ""}, {WINED3D_SM5_OP_DCL_HS_MAX_TESSFACTOR, WINED3DSIH_DCL_HS_MAX_TESSFACTOR, "", ""}, {WINED3D_SM5_OP_DCL_HS_FORK_PHASE_INSTANCE_COUNT, WINED3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT, "", ""}, {WINED3D_SM5_OP_DCL_UAV_TYPED, WINED3DSIH_DCL_UAV_TYPED, "", ""}, @@ -1046,8 +1048,13 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi } else if (opcode == WINED3D_SM5_OP_DCL_TESSELLATOR_DOMAIN) { - ins->declaration.tessellator_domain = (opcode_token & WINED3D_SM5_TESSELLATOR_DOMAIN_MASK) - >> WINED3D_SM5_TESSELLATOR_DOMAIN_SHIFT; + ins->declaration.tessellator_domain = (opcode_token & WINED3D_SM5_TESSELLATOR_MASK) + >> WINED3D_SM5_TESSELLATOR_SHIFT; + } + else if (opcode == WINED3D_SM5_OP_DCL_TESSELLATOR_OUTPUT_PRIMITIVE) + { + ins->declaration.tessellator_output_primitive = (opcode_token & WINED3D_SM5_TESSELLATOR_MASK) + >> WINED3D_SM5_TESSELLATOR_SHIFT; } else if (opcode == WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7f3f18e4fa2..0bcc82d2b36 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -446,6 +446,14 @@ enum wined3d_tessellator_domain WINED3D_TESSELLATOR_DOMAIN_QUAD = 3, }; +enum wined3d_tessellator_output_primitive +{ + WINED3D_TESSELLATOR_OUTPUT_POINT = 1, + WINED3D_TESSELLATOR_OUTPUT_LINE = 2, + WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, + WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4, +}; + /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */ #define WINED3DSI_TEXLD_PROJECT 0x1 #define WINED3DSI_TEXLD_BIAS 0x2 @@ -539,6 +547,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_DCL_SAMPLER, WINED3DSIH_DCL_TEMPS, WINED3DSIH_DCL_TESSELLATOR_DOMAIN, + WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE, WINED3DSIH_DCL_UAV_TYPED, WINED3DSIH_DCL_VERTICES_OUT, WINED3DSIH_DEF, @@ -866,6 +875,7 @@ struct wined3d_shader_instruction const struct wined3d_shader_immediate_constant_buffer *icb; struct wined3d_shader_structured_resource structured_resource; enum wined3d_tessellator_domain tessellator_domain; + enum wined3d_tessellator_output_primitive tessellator_output_primitive; float max_tessellation_factor; } declaration; };