=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Load unordered access resources before binding shader resources.
Alexandre Julliard
julliard at winehq.org
Wed Feb 22 15:42:03 CST 2017
Module: wine
Branch: master
Commit: cab9282d10e4b2868a0dd85383b1126c0d6c591a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cab9282d10e4b2868a0dd85383b1126c0d6c591a
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Wed Feb 22 13:19:26 2017 +0100
wined3d: Load unordered access resources before binding shader resources.
Loading a texture might invalidate shader resource view bindings.
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/wined3d/context.c | 44 ++++++++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 93b49a0..a58a905 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3406,16 +3406,13 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
}
}
-static void context_bind_unordered_access_views(struct wined3d_context *context,
+static void context_load_unordered_access_resources(struct wined3d_context *context,
const struct wined3d_shader *shader, struct wined3d_unordered_access_view * const *views)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_unordered_access_view *view;
- struct wined3d_texture *texture = NULL;
+ struct wined3d_texture *texture;
struct wined3d_buffer *buffer;
- GLuint texture_name;
unsigned int i;
- GLint level;
context->uses_uavs = 0;
@@ -3428,11 +3425,7 @@ static void context_bind_unordered_access_views(struct wined3d_context *context,
continue;
if (!(view = views[i]))
- {
- WARN("No unordered access view bound at index %u.\n", i);
- GL_EXTCALL(glBindImageTexture(i, 0, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8));
continue;
- }
if (view->resource->type == WINED3D_RTYPE_BUFFER)
{
@@ -3448,14 +3441,41 @@ static void context_bind_unordered_access_views(struct wined3d_context *context,
}
context->uses_uavs = 1;
+ }
+}
+
+static void context_bind_unordered_access_views(struct wined3d_context *context,
+ const struct wined3d_shader *shader, struct wined3d_unordered_access_view * const *views)
+{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+ struct wined3d_unordered_access_view *view;
+ GLuint texture_name;
+ unsigned int i;
+ GLint level;
+
+ if (!shader)
+ return;
+
+ for (i = 0; i < MAX_UNORDERED_ACCESS_VIEWS; ++i)
+ {
+ if (!shader->reg_maps.uav_resource_info[i].type)
+ continue;
+
+ if (!(view = views[i]))
+ {
+ WARN("No unordered access view bound at index %u.\n", i);
+ GL_EXTCALL(glBindImageTexture(i, 0, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8));
+ continue;
+ }
if (view->gl_view.name)
{
texture_name = view->gl_view.name;
level = 0;
}
- else if (texture)
+ else if (view->resource->type != WINED3D_RTYPE_BUFFER)
{
+ struct wined3d_texture *texture = texture_from_resource(view->resource);
texture_name = wined3d_texture_get_gl_texture(texture, FALSE)->name;
level = view->desc.u.texture.level_idx;
}
@@ -3496,6 +3516,8 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
context_update_tex_unit_map(context, state);
context_preload_textures(context, state);
context_load_shader_resources(context, state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
+ context_load_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_PIXEL],
+ state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
/* TODO: Right now the dependency on the vertex shader is necessary
* since context_stream_info_from_declaration depends on the reg_maps of
* the current VS but maybe it's possible to relax the coupling in some
@@ -3579,6 +3601,8 @@ void context_apply_compute_state(struct wined3d_context *context,
unsigned int state_id, i, j;
context_load_shader_resources(context, state, 1u << WINED3D_SHADER_TYPE_COMPUTE);
+ context_load_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_COMPUTE],
+ state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]);
for (i = 0, state_id = STATE_COMPUTE_OFFSET; i < ARRAY_SIZE(context->dirty_compute_states); ++i)
{
More information about the wine-cvs
mailing list