=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Implement SM5 store_uav_typed instruction.
Alexandre Julliard
julliard at winehq.org
Wed Feb 8 15:52:12 CST 2017
Module: wine
Branch: master
Commit: 94a214b2bbf8f486619bc0d1d88003b2f6f3b85a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=94a214b2bbf8f486619bc0d1d88003b2f6f3b85a
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Wed Feb 8 11:54:15 2017 +0100
wined3d: Implement SM5 store_uav_typed instruction.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d11/tests/d3d11.c | 10 +++++-----
dlls/wined3d/glsl_shader.c | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index ca27354..da5b02c 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -12776,18 +12776,18 @@ static void test_ps_cs_uav_binding(void)
check_texture_float(ps_texture, 0.0f, 2);
draw_quad(&test_context);
todo_wine check_texture_float(cs_texture, 1.0f, 2);
- todo_wine check_texture_float(ps_texture, 1.0f, 2);
+ check_texture_float(ps_texture, 1.0f, 2);
input.x = 0.5f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cs_cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
todo_wine check_texture_float(cs_texture, 0.5f, 2);
- todo_wine check_texture_float(ps_texture, 1.0f, 2);
+ check_texture_float(ps_texture, 1.0f, 2);
input.x = 2.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)ps_cb, 0, NULL, &input, 0, 0);
draw_quad(&test_context);
todo_wine check_texture_float(cs_texture, 0.5f, 2);
- todo_wine check_texture_float(ps_texture, 2.0f, 2);
+ check_texture_float(ps_texture, 2.0f, 2);
input.x = 8.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cs_cb, 0, NULL, &input, 0, 0);
@@ -12795,10 +12795,10 @@ static void test_ps_cs_uav_binding(void)
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)ps_cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
todo_wine check_texture_float(cs_texture, 8.0f, 2);
- todo_wine check_texture_float(ps_texture, 2.0f, 2);
+ check_texture_float(ps_texture, 2.0f, 2);
draw_quad(&test_context);
todo_wine check_texture_float(cs_texture, 8.0f, 2);
- todo_wine check_texture_float(ps_texture, 4.0f, 2);
+ check_texture_float(ps_texture, 4.0f, 2);
ID3D11ComputeShader_Release(cs);
ID3D11PixelShader_Release(ps);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e47d18b..2663403 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4922,7 +4922,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
if (resource_type >= ARRAY_SIZE(resource_type_info))
{
ERR("Unexpected resource type %#x.\n", resource_type);
- resource_type = WINED3D_SHADER_RESOURCE_TEXTURE_2D;
+ return;
}
data_type = reg_maps->uav_resource_info[uav_idx].data_type;
coord_mask = (1u << resource_type_info[resource_type].coord_size) - 1;
@@ -4968,6 +4968,38 @@ static void shader_glsl_ld_uav(const struct wined3d_shader_instruction *ins)
shader_glsl_get_prefix(version->type), uav_idx, image_coord_param.param_str, dst_swizzle);
}
+static void shader_glsl_store_uav(const struct wined3d_shader_instruction *ins)
+{
+ const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
+ const struct wined3d_shader_version *version = ®_maps->shader_version;
+ struct glsl_src_param image_coord_param, image_data_param;
+ enum wined3d_shader_resource_type resource_type;
+ enum wined3d_data_type data_type;
+ unsigned int uav_idx;
+ DWORD coord_mask;
+
+ uav_idx = ins->dst[0].reg.idx[0].offset;
+ if (uav_idx >= ARRAY_SIZE(reg_maps->uav_resource_info))
+ {
+ ERR("Invalid UAV index %u.\n", uav_idx);
+ return;
+ }
+ resource_type = reg_maps->uav_resource_info[uav_idx].type;
+ if (resource_type >= ARRAY_SIZE(resource_type_info))
+ {
+ ERR("Unexpected resource type %#x.\n", resource_type);
+ return;
+ }
+ data_type = reg_maps->uav_resource_info[uav_idx].data_type;
+ coord_mask = (1u << resource_type_info[resource_type].coord_size) - 1;
+
+ shader_glsl_add_src_param(ins, &ins->src[0], coord_mask, &image_coord_param);
+ shader_glsl_add_src_param_ext(ins, &ins->src[1], WINED3DSP_WRITEMASK_ALL, &image_data_param, data_type);
+ shader_addline(ins->ctx->buffer, "imageStore(%s_image%u, %s, %s);\n",
+ shader_glsl_get_prefix(version->type), uav_idx,
+ image_coord_param.param_str, image_data_param.param_str);
+}
+
static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
{
const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version;
@@ -9094,7 +9126,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
/* WINED3DSIH_SQRT */ shader_glsl_map2gl,
/* WINED3DSIH_STORE_RAW */ NULL,
/* WINED3DSIH_STORE_STRUCTURED */ NULL,
- /* WINED3DSIH_STORE_UAV_TYPED */ NULL,
+ /* WINED3DSIH_STORE_UAV_TYPED */ shader_glsl_store_uav,
/* WINED3DSIH_SUB */ shader_glsl_binop,
/* WINED3DSIH_SWAPC */ NULL,
/* WINED3DSIH_SWITCH */ shader_glsl_switch,
More information about the wine-cvs
mailing list