Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/buffer.c | 2 +- dlls/wined3d/cs.c | 6 +++++- dlls/wined3d/device.c | 5 +---- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index ea21f85bc9e..12d038c0120 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1047,7 +1047,7 @@ static void wined3d_buffer_init_data(struct wined3d_buffer *buffer, if (buffer->flags & WINED3D_BUFFER_USE_BO) { wined3d_box_set(&box, 0, 0, resource->size, 1, 0, 1); - wined3d_device_context_emit_update_sub_resource(&device->cs->c, resource, + device->cs->c.ops->update_sub_resource(&device->cs->c, resource, 0, &box, data->data, data->row_pitch, data->slice_pitch); } else diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 11f2d7cd5c7..5d9d19a85af 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2548,12 +2548,14 @@ done: wined3d_resource_release(resource); }
-void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context, +static void wined3d_cs_update_sub_resource(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int slice_pitch) { struct wined3d_cs_update_sub_resource *op;
+ wined3d_resource_wait_idle(resource); + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; op->resource = resource; @@ -2823,6 +2825,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = wined3d_cs_st_push_constants, wined3d_cs_map, wined3d_cs_unmap, + wined3d_cs_update_sub_resource, wined3d_cs_issue_query, wined3d_cs_flush, wined3d_cs_acquire_resource, @@ -2949,6 +2952,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops = wined3d_cs_mt_push_constants, wined3d_cs_map, wined3d_cs_unmap, + wined3d_cs_update_sub_resource, wined3d_cs_issue_query, wined3d_cs_flush, wined3d_cs_acquire_resource, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4361a0637db..d9ce95b3f3e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5195,10 +5195,7 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont return; }
- wined3d_resource_wait_idle(resource); - - wined3d_device_context_emit_update_sub_resource(context, resource, - sub_resource_idx, box, data, row_pitch, depth_pitch); + context->ops->update_sub_resource(context, resource, sub_resource_idx, box, data, row_pitch, depth_pitch); }
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context, diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index e60ba8fff77..82facaecd29 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -4398,7 +4398,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct for (i = 0; i < sub_count; ++i) { wined3d_texture_get_level_box(*texture, i % (*texture)->level_count, &box); - wined3d_device_context_emit_update_sub_resource(&device->cs->c, &(*texture)->resource, + device->cs->c.ops->update_sub_resource(&device->cs->c, &(*texture)->resource, i, &box, data[i].data, data[i].row_pitch, data[i].slice_pitch); } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f4060224de9..55fd7b450df 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4694,6 +4694,9 @@ struct wined3d_device_context_ops unsigned int flags); HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx); + void (*update_sub_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource, + unsigned int sub_resource_idx, const struct wined3d_box *box, + const void *data, unsigned int row_pitch, unsigned int slice_pitch); void (*issue_query)(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags); void (*flush)(struct wined3d_device_context *context); void (*acquire_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource); @@ -4829,9 +4832,6 @@ void wined3d_device_context_emit_set_vertex_declaration(struct wined3d_device_co struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count, const struct wined3d_viewport *viewports) DECLSPEC_HIDDEN; -void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_context *context, - struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, - const void *data, unsigned int row_pitch, unsigned int slice_pitch) DECLSPEC_HIDDEN;
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource) {