wined3d: Use wined3d_buffer_copy_bo_address() in wined3d_cs_exec_update_sub_resource().

Signed-off-by: Zebediah Figura <z.figura12@gmail.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-06-28 11:39:02 -05:00 committed by Alexandre Julliard
parent 447a748c51
commit a260928b81
3 changed files with 4 additions and 32 deletions

View File

@ -1054,25 +1054,6 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off
context_release(context); context_release(context);
} }
void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_box *box, const void *data)
{
struct wined3d_range range;
if (box)
{
range.offset = box->left;
range.size = box->right - box->left;
}
else
{
range.offset = 0;
range.size = buffer->resource.size;
}
buffer->buffer_ops->buffer_upload_ranges(buffer, context, data, range.offset, 1, &range);
}
static void wined3d_buffer_init_data(struct wined3d_buffer *buffer, static void wined3d_buffer_init_data(struct wined3d_buffer *buffer,
struct wined3d_device *device, const struct wined3d_sub_resource_data *data) struct wined3d_device *device, const struct wined3d_sub_resource_data *data)
{ {

View File

@ -2613,18 +2613,14 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
context = context_acquire(cs->c.device, NULL, 0); context = context_acquire(cs->c.device, NULL, 0);
addr.buffer_object = 0;
addr.addr = op->data.data;
if (resource->type == WINED3D_RTYPE_BUFFER) if (resource->type == WINED3D_RTYPE_BUFFER)
{ {
struct wined3d_buffer *buffer = buffer_from_resource(resource); struct wined3d_buffer *buffer = buffer_from_resource(resource);
if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER)) wined3d_buffer_copy_bo_address(buffer, context, box->left, &addr, box->right - box->left);
{
ERR("Failed to load buffer location.\n");
goto done;
}
wined3d_buffer_upload_data(buffer, context, box, op->data.data);
wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER);
goto done; goto done;
} }
@ -2635,9 +2631,6 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
height = wined3d_texture_get_level_height(texture, level); height = wined3d_texture_get_level_height(texture, level);
depth = wined3d_texture_get_level_depth(texture, level); depth = wined3d_texture_get_level_depth(texture, level);
addr.buffer_object = 0;
addr.addr = op->data.data;
/* Only load the sub-resource for partial updates. */ /* Only load the sub-resource for partial updates. */
if (!box->left && !box->top && !box->front if (!box->left && !box->top && !box->front
&& box->right == width && box->bottom == height && box->back == depth) && box->right == width && box->bottom == height && box->back == depth)

View File

@ -4930,8 +4930,6 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer,
BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer, BOOL wined3d_buffer_prepare_location(struct wined3d_buffer *buffer,
struct wined3d_context *context, unsigned int location) DECLSPEC_HIDDEN; struct wined3d_context *context, unsigned int location) DECLSPEC_HIDDEN;
void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
HRESULT wined3d_buffer_no3d_init(struct wined3d_buffer *buffer_no3d, struct wined3d_device *device, 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, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data,