wined3d: Introduce a wined3d_buffer_update_sub_resource() helper.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-11-08 16:34:44 -06:00 committed by Alexandre Julliard
parent d630aa20bf
commit 1b16a606f7
3 changed files with 13 additions and 7 deletions

View File

@ -1093,6 +1093,15 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
context_release(context);
}
void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct upload_bo *upload_bo, unsigned int offset, unsigned int size)
{
if (upload_bo->addr.buffer_object && upload_bo->addr.buffer_object == (uintptr_t)buffer->buffer_object)
wined3d_context_flush_bo_address(context, &upload_bo->addr, size);
else
wined3d_buffer_copy_bo_address(buffer, context, offset, &upload_bo->addr, size);
}
static void wined3d_buffer_init_data(struct wined3d_buffer *buffer,
struct wined3d_device *device, const struct wined3d_sub_resource_data *data)
{

View File

@ -2742,13 +2742,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
if (resource->type == WINED3D_RTYPE_BUFFER)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
size_t size = box->right - box->left;
if (op->bo.addr.buffer_object && op->bo.addr.buffer_object == (uintptr_t)buffer->buffer_object)
wined3d_context_flush_bo_address(context, &op->bo.addr, size);
else
wined3d_buffer_copy_bo_address(buffer, context, box->left, &op->bo.addr, size);
wined3d_buffer_update_sub_resource(buffer_from_resource(resource),
context, &op->bo, box->left, box->right - box->left);
goto done;
}

View File

@ -5072,6 +5072,8 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
struct wined3d_context *context, unsigned int location) DECLSPEC_HIDDEN;
void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct upload_bo *upload_bo, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_no3d_init(struct wined3d_buffer *buffer_no3d, struct wined3d_device *device,
const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data,