wined3d: Implement wined3d_unordered_access_view_copy_counter() on top of wined3d_context_copy_bo_address().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-04-21 22:37:12 +04:30 committed by Alexandre Julliard
parent 97272f58ce
commit 6672708b02
2 changed files with 6 additions and 5 deletions

View File

@ -1059,21 +1059,20 @@ void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_v
void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view *view, void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view *view,
struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context) struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context)
{ {
struct wined3d_unordered_access_view_gl *view_gl = wined3d_unordered_access_view_gl(view);
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
struct wined3d_bo_address dst, src; struct wined3d_bo_address dst, src;
DWORD dst_location; DWORD dst_location;
if (!view_gl->counter_bo.id) if (!view->counter_bo)
return; return;
dst_location = wined3d_buffer_get_memory(buffer, &dst, buffer->locations); dst_location = wined3d_buffer_get_memory(buffer, &dst, buffer->locations);
dst.addr += offset; dst.addr += offset;
src.buffer_object = (uintptr_t)&view_gl->counter_bo; src.buffer_object = view->counter_bo;
src.addr = NULL; src.addr = NULL;
wined3d_context_gl_copy_bo_address(context_gl, &dst, &src, sizeof(GLuint)); wined3d_context_copy_bo_address(context, &dst, buffer->resource.bind_flags,
&src, WINED3D_BIND_UNORDERED_ACCESS, sizeof(uint32_t));
wined3d_buffer_invalidate_location(buffer, ~dst_location); wined3d_buffer_invalidate_location(buffer, ~dst_location);
} }
@ -1105,6 +1104,7 @@ static void wined3d_unordered_access_view_gl_cs_init(void *object)
GL_EXTCALL(glBindBuffer(bo->binding, bo->id)); GL_EXTCALL(glBindBuffer(bo->binding, bo->id));
GL_EXTCALL(glBufferData(bo->binding, sizeof(initial_value), &initial_value, GL_STATIC_DRAW)); GL_EXTCALL(glBufferData(bo->binding, sizeof(initial_value), &initial_value, GL_STATIC_DRAW));
checkGLcall("create atomic counter buffer"); checkGLcall("create atomic counter buffer");
view_gl->v.counter_bo = (uintptr_t)bo;
} }
context_release(context); context_release(context);
} }

View File

@ -4582,6 +4582,7 @@ struct wined3d_unordered_access_view
const struct wined3d_format *format; const struct wined3d_format *format;
struct wined3d_view_desc desc; struct wined3d_view_desc desc;
uintptr_t counter_bo;
}; };
void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view *view) DECLSPEC_HIDDEN; void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view *view) DECLSPEC_HIDDEN;