Commit 783c850d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Factor out wined3d_buffer_copy_bo_address().

parent 334a3bbe
......@@ -1009,28 +1009,36 @@ static HRESULT buffer_resource_sub_resource_unmap(struct wined3d_resource *resou
return WINED3D_OK;
}
void wined3d_buffer_copy_bo_address(struct wined3d_buffer *dst_buffer, struct wined3d_context *context,
unsigned int dst_offset, const struct wined3d_const_bo_address *src_addr, unsigned int size)
{
struct wined3d_bo_address dst_addr;
DWORD dst_location;
dst_location = wined3d_buffer_get_memory(dst_buffer, context, &dst_addr);
dst_addr.addr += dst_offset;
wined3d_context_copy_bo_address(context, &dst_addr, (const struct wined3d_bo_address *)src_addr, size);
wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
}
void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size)
{
struct wined3d_bo_address dst, src;
struct wined3d_context *context;
DWORD dst_location;
struct wined3d_bo_address src;
TRACE("dst_buffer %p, dst_offset %u, src_buffer %p, src_offset %u, size %u.\n",
dst_buffer, dst_offset, src_buffer, src_offset, size);
context = context_acquire(dst_buffer->resource.device, NULL, 0);
dst_location = wined3d_buffer_get_memory(dst_buffer, context, &dst);
dst.addr += dst_offset;
wined3d_buffer_get_memory(src_buffer, context, &src);
src.addr += src_offset;
wined3d_context_copy_bo_address(context, &dst, &src, size);
context_release(context);
wined3d_buffer_copy_bo_address(dst_buffer, context, dst_offset, wined3d_const_bo_address(&src), size);
wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
context_release(context);
}
void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
......
......@@ -1605,21 +1605,15 @@ 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,
struct wined3d_buffer *buffer, unsigned int offset, struct wined3d_context *context)
{
struct wined3d_bo_address dst, src;
DWORD dst_location;
struct wined3d_const_bo_address src;
if (!view->counter_bo)
return;
dst_location = wined3d_buffer_get_memory(buffer, context, &dst);
dst.addr += offset;
src.buffer_object = view->counter_bo;
src.addr = NULL;
wined3d_context_copy_bo_address(context, &dst, &src, sizeof(uint32_t));
wined3d_buffer_invalidate_location(buffer, ~dst_location);
wined3d_buffer_copy_bo_address(buffer, context, offset, &src, sizeof(uint32_t));
}
void wined3d_unordered_access_view_gl_update(struct wined3d_unordered_access_view_gl *uav_gl,
......
......@@ -4899,6 +4899,8 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
void wined3d_buffer_cleanup(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN;
void wined3d_buffer_copy_bo_address(struct wined3d_buffer *dst_buffer, struct wined3d_context *context,
unsigned int dst_offset, const struct wined3d_const_bo_address *src_addr, unsigned int size) DECLSPEC_HIDDEN;
DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment