From f2c668e7797078799deecd7ed1e074402d52a2ea Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 24 Sep 2019 17:50:42 +0330 Subject: [PATCH] wined3d: Make the adapter responsible for clearing UAVs. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/adapter_gl.c | 10 ++++++++++ dlls/wined3d/adapter_vk.c | 7 +++++++ dlls/wined3d/cs.c | 2 +- dlls/wined3d/directx.c | 7 +++++++ dlls/wined3d/view.c | 15 +++++++-------- dlls/wined3d/wined3d_private.h | 6 ++++-- 6 files changed, 36 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 03799b6aa84..e161f7261b5 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -5073,6 +5073,15 @@ static void adapter_gl_flush_context(struct wined3d_context *context) context_gl->gl_info->gl_ops.gl.p_glFlush(); } +void adapter_gl_clear_uav(struct wined3d_context *context, + struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) +{ + TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value)); + + wined3d_unordered_access_view_gl_clear_uint(wined3d_unordered_access_view_gl(view), + clear_value, wined3d_context_gl(context)); +} + static const struct wined3d_adapter_ops wined3d_adapter_gl_ops = { adapter_gl_destroy, @@ -5103,6 +5112,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops = adapter_gl_create_query, adapter_gl_destroy_query, adapter_gl_flush_context, + adapter_gl_clear_uav, }; static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_gl, uint32_t wined3d_creation_flags) diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 91a81b47e63..0d83cf7582c 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -802,6 +802,12 @@ static void adapter_vk_flush_context(struct wined3d_context *context) TRACE("context %p.\n", context); } +void adapter_vk_clear_uav(struct wined3d_context *context, + struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) +{ + FIXME("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value)); +} + static const struct wined3d_adapter_ops wined3d_adapter_vk_ops = { adapter_vk_destroy, @@ -832,6 +838,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops = adapter_vk_create_query, adapter_vk_destroy_query, adapter_vk_flush_context, + adapter_vk_clear_uav, }; static unsigned int wined3d_get_wine_vk_version(void) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 044d586b29b..ec17b59d714 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2424,7 +2424,7 @@ static void wined3d_cs_exec_clear_unordered_access_view(struct wined3d_cs *cs, c struct wined3d_context *context; context = context_acquire(cs->device, NULL, 0); - wined3d_unordered_access_view_clear_uint(view, &op->clear_value, context); + cs->device->adapter->adapter_ops->adapter_clear_uav(context, view, &op->clear_value); context_release(context); wined3d_resource_release(view->resource); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 2c3d2787bc8..24fab8491a1 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2607,6 +2607,12 @@ static void adapter_no3d_flush_context(struct wined3d_context *context) TRACE("context %p.\n", context); } +void adapter_no3d_clear_uav(struct wined3d_context *context, + struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) +{ + ERR("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value)); +} + static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops = { adapter_no3d_destroy, @@ -2637,6 +2643,7 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops = adapter_no3d_create_query, adapter_no3d_destroy_query, adapter_no3d_flush_context, + adapter_no3d_clear_uav, }; static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter *adapter, unsigned int wined3d_creation_flags) diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 0b4c296f170..f7bb18934fa 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -995,17 +995,16 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_ wined3d_view_invalidate_location(view->resource, &view->desc, location); } -void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view *view, - const struct wined3d_uvec4 *clear_value, struct wined3d_context *context) +void wined3d_unordered_access_view_gl_clear_uint(struct wined3d_unordered_access_view_gl *view_gl, + const struct wined3d_uvec4 *clear_value, struct wined3d_context_gl *context_gl) { - struct wined3d_context_gl *context_gl = wined3d_context_gl(context); const struct wined3d_gl_info *gl_info = context_gl->gl_info; const struct wined3d_format_gl *format; struct wined3d_buffer_gl *buffer_gl; struct wined3d_resource *resource; unsigned int offset, size; - resource = view->resource; + resource = view_gl->v.resource; if (resource->type != WINED3D_RTYPE_BUFFER) { FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type)); @@ -1018,7 +1017,7 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi return; } - format = wined3d_format_gl(view->format); + format = wined3d_format_gl(view_gl->v.format); if (format->f.id != WINED3DFMT_R32_UINT && format->f.id != WINED3DFMT_R32_SINT && format->f.id != WINED3DFMT_R32G32B32A32_UINT && format->f.id != WINED3DFMT_R32G32B32A32_SINT) @@ -1028,10 +1027,10 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi } buffer_gl = wined3d_buffer_gl(buffer_from_resource(resource)); - wined3d_buffer_load_location(&buffer_gl->b, context, WINED3D_LOCATION_BUFFER); - wined3d_unordered_access_view_invalidate_location(view, ~WINED3D_LOCATION_BUFFER); + wined3d_buffer_load_location(&buffer_gl->b, &context_gl->c, WINED3D_LOCATION_BUFFER); + wined3d_unordered_access_view_invalidate_location(&view_gl->v, ~WINED3D_LOCATION_BUFFER); - get_buffer_view_range(&buffer_gl->b, &view->desc, &format->f, &offset, &size); + get_buffer_view_range(&buffer_gl->b, &view_gl->v.desc, &format->f, &offset, &size); wined3d_context_gl_bind_bo(context_gl, buffer_gl->buffer_type_hint, buffer_gl->b.buffer_object); GL_EXTCALL(glClearBufferSubData(buffer_gl->buffer_type_hint, format->internal, offset, size, format->format, format->type, clear_value)); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 15a272db17d..648e3f0dee0 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2851,6 +2851,8 @@ struct wined3d_adapter_ops void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query); void (*adapter_destroy_query)(struct wined3d_query *query); void (*adapter_flush_context)(struct wined3d_context *context); + void (*adapter_clear_uav)(struct wined3d_context *context, + struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value); }; /* The adapter structure */ @@ -4377,8 +4379,6 @@ struct wined3d_unordered_access_view }; void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view *view) DECLSPEC_HIDDEN; -void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view *view, - const struct wined3d_uvec4 *clear_value, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view *view, struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context) DECLSPEC_HIDDEN; void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view *view, @@ -4399,6 +4399,8 @@ static inline struct wined3d_unordered_access_view_gl *wined3d_unordered_access_ return CONTAINING_RECORD(view, struct wined3d_unordered_access_view_gl, v); } +void wined3d_unordered_access_view_gl_clear_uint(struct wined3d_unordered_access_view_gl *view_gl, + const struct wined3d_uvec4 *clear_value, struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN; HRESULT wined3d_unordered_access_view_gl_init(struct wined3d_unordered_access_view_gl *view_gl, const struct wined3d_view_desc *desc, struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;