From a592f35d498964eb33a8884f6ebca5946440b541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 30 Nov 2016 12:47:32 +0100 Subject: [PATCH] wined3d: Recognize SM5 dcl_uav_structured 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 | 14 ++++++++++++++ dlls/wined3d/shader_sm4.c | 14 +++++++++++++- dlls/wined3d/wined3d_private.h | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index f8665ddb1e5..70480214d98 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_TGSM_STRUCTURED */ NULL, /* WINED3DSIH_DCL_THREAD_GROUP */ NULL, /* WINED3DSIH_DCL_UAV_RAW */ NULL, + /* WINED3DSIH_DCL_UAV_STRUCTURED */ 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 3afed694dce..f1f615d4c51 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -8912,6 +8912,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_DCL_TGSM_STRUCTURED */ NULL, /* WINED3DSIH_DCL_THREAD_GROUP */ NULL, /* WINED3DSIH_DCL_UAV_RAW */ NULL, + /* WINED3DSIH_DCL_UAV_STRUCTURED */ NULL, /* WINED3DSIH_DCL_UAV_TYPED */ shader_glsl_nop, /* 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 05ab24d721e..765c6825001 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -90,6 +90,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_DCL_TGSM_STRUCTURED */ "dcl_tgsm_structured", /* WINED3DSIH_DCL_THREAD_GROUP */ "dcl_thread_group", /* WINED3DSIH_DCL_UAV_RAW */ "dcl_uav_raw", + /* WINED3DSIH_DCL_UAV_STRUCTURED */ "dcl_uav_structured", /* WINED3DSIH_DCL_UAV_TYPED */ "dcl_uav_typed", /* WINED3DSIH_DCL_VERTICES_OUT */ "dcl_maxOutputVertexCount", /* WINED3DSIH_DEF */ "def", @@ -1465,6 +1466,11 @@ static void shader_dump_uav_flags(struct wined3d_string_buffer *buffer, DWORD ua shader_addline(buffer, "_glc"); uav_flags &= ~WINED3DSUF_GLOBALLY_COHERENT; } + if (uav_flags & WINED3DSUF_ORDER_PRESERVING_COUNTER) + { + shader_addline(buffer, "_opc"); + uav_flags &= ~WINED3DSUF_ORDER_PRESERVING_COUNTER; + } if (uav_flags) shader_addline(buffer, "_unknown_flags(%#x)", uav_flags); @@ -2437,6 +2443,14 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe shader_addline(&buffer, " "); shader_dump_dst_param(&buffer, &ins.declaration.dst, &shader_version); } + else if (ins.handler_idx == WINED3DSIH_DCL_UAV_STRUCTURED) + { + shader_addline(&buffer, "%s", shader_opcode_names[ins.handler_idx]); + shader_dump_uav_flags(&buffer, ins.flags); + shader_addline(&buffer, " "); + shader_dump_dst_param(&buffer, &ins.declaration.structured_resource.reg, &shader_version); + shader_addline(&buffer, ", %u", ins.declaration.structured_resource.byte_stride); + } 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 94b12298473..30dec14548e 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -65,7 +65,7 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode); #define WINED3D_SM5_CONTROL_POINT_COUNT_MASK (0xffu << WINED3D_SM5_CONTROL_POINT_COUNT_SHIFT) #define WINED3D_SM5_UAV_FLAGS_SHIFT 11 -#define WINED3D_SM5_UAV_FLAGS_MASK (0xffu << WINED3D_SM5_UAV_FLAGS_SHIFT) +#define WINED3D_SM5_UAV_FLAGS_MASK (0x8fffu << WINED3D_SM5_UAV_FLAGS_SHIFT) #define WINED3D_SM5_SYNC_FLAGS_SHIFT 11 #define WINED3D_SM5_SYNC_FLAGS_MASK (0xffu << WINED3D_SM5_SYNC_FLAGS_SHIFT) @@ -241,6 +241,7 @@ enum wined3d_sm4_opcode WINED3D_SM5_OP_DCL_THREAD_GROUP = 0x9b, WINED3D_SM5_OP_DCL_UAV_TYPED = 0x9c, WINED3D_SM5_OP_DCL_UAV_RAW = 0x9d, + WINED3D_SM5_OP_DCL_UAV_STRUCTURED = 0x9e, WINED3D_SM5_OP_DCL_TGSM_RAW = 0x9f, WINED3D_SM5_OP_DCL_TGSM_STRUCTURED = 0xa0, WINED3D_SM5_OP_DCL_RESOURCE_STRUCTURED = 0xa2, @@ -672,6 +673,15 @@ static void shader_sm5_read_dcl_uav_raw(struct wined3d_shader_instruction *ins, ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT; } +static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction *ins, + DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, + struct wined3d_sm4_data *priv) +{ + shader_sm4_read_dst_param(priv, &tokens, WINED3D_DATA_UAV, &ins->declaration.structured_resource.reg); + ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT; + ins->declaration.structured_resource.byte_stride = *tokens; +} + static void shader_sm5_read_dcl_tgsm_raw(struct wined3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct wined3d_sm4_data *priv) @@ -872,6 +882,8 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = shader_sm4_read_dcl_resource}, {WINED3D_SM5_OP_DCL_UAV_RAW, WINED3DSIH_DCL_UAV_RAW, "", "", shader_sm5_read_dcl_uav_raw}, + {WINED3D_SM5_OP_DCL_UAV_STRUCTURED, WINED3DSIH_DCL_UAV_STRUCTURED, "", "", + shader_sm5_read_dcl_uav_structured}, {WINED3D_SM5_OP_DCL_TGSM_RAW, WINED3DSIH_DCL_TGSM_RAW, "", "", shader_sm5_read_dcl_tgsm_raw}, {WINED3D_SM5_OP_DCL_TGSM_STRUCTURED, WINED3DSIH_DCL_TGSM_STRUCTURED, "", "", diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 31ab656b21b..cc3dd58de3f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -472,6 +472,7 @@ enum wined3d_shader_sync_flags enum wined3d_shader_uav_flags { WINED3DSUF_GLOBALLY_COHERENT = 0x20, + WINED3DSUF_ORDER_PRESERVING_COUNTER = 0x8000, }; enum wined3d_tessellator_domain @@ -615,6 +616,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_DCL_TGSM_STRUCTURED, WINED3DSIH_DCL_THREAD_GROUP, WINED3DSIH_DCL_UAV_RAW, + WINED3DSIH_DCL_UAV_STRUCTURED, WINED3DSIH_DCL_UAV_TYPED, WINED3DSIH_DCL_VERTICES_OUT, WINED3DSIH_DEF,