Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 9 +++++++++ dlls/wined3d/cs.c | 9 ++------- dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 0634dd93e2d..fca8ab707f2 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1101,6 +1101,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) { diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 3143865c469..1d909e0c706 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2744,13 +2744,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; }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0b5165dbb5e..fc950cda3c3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5077,6 +5077,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,