From a78afa1c716b03083f7ede461ffdc041a8134c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 23 Feb 2017 15:00:54 +0100 Subject: [PATCH] wined3d: Handle structured UAV declarations. 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/glsl_shader.c | 2 +- dlls/wined3d/shader.c | 15 +++++++++++++++ dlls/wined3d/shader_sm4.c | 2 ++ dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index f026e78b5cf..9893d11beb7 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -9352,7 +9352,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_DCL_TGSM_STRUCTURED */ NULL, /* WINED3DSIH_DCL_THREAD_GROUP */ shader_glsl_nop, /* WINED3DSIH_DCL_UAV_RAW */ shader_glsl_nop, - /* WINED3DSIH_DCL_UAV_STRUCTURED */ NULL, + /* WINED3DSIH_DCL_UAV_STRUCTURED */ shader_glsl_nop, /* 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 3b5d6eefe1a..3085248f91f 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1058,6 +1058,21 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT; reg_maps->uav_resource_info[reg_idx].flags = WINED3D_VIEW_BUFFER_RAW; } + else if (ins.handler_idx == WINED3DSIH_DCL_UAV_STRUCTURED) + { + unsigned int reg_idx = ins.declaration.structured_resource.reg.reg.idx[0].offset; + if (reg_idx >= ARRAY_SIZE(reg_maps->uav_resource_info)) + { + ERR("Invalid UAV resource index %u.\n", reg_idx); + break; + } + if (ins.flags) + FIXME("Ignoring structured UAV flags %#x.\n", ins.flags); + reg_maps->uav_resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER; + reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT; + reg_maps->uav_resource_info[reg_idx].flags = 0; + reg_maps->uav_resource_info[reg_idx].stride = ins.declaration.structured_resource.byte_stride / 4; + } else if (ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT) { if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY) diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index baffe2ddfbd..877b27d7c33 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -753,6 +753,8 @@ static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction 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; + if (ins->declaration.structured_resource.byte_stride % 4) + FIXME("Byte stride %u is not multiple of 4.\n", ins->declaration.structured_resource.byte_stride); } static void shader_sm5_read_dcl_tgsm_raw(struct wined3d_shader_instruction *ins, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 087e4d24a56..79500110d7e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -827,6 +827,7 @@ struct wined3d_shader_resource_info enum wined3d_shader_resource_type type; enum wined3d_data_type data_type; unsigned int flags; + unsigned int stride; }; #define WINED3D_SAMPLER_DEFAULT ~0x0u