Commit d5b42009 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Update resources through wined3d_device_context_ops.

parent 574b7152
......@@ -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
......
......@@ -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,
......
......@@ -5208,10 +5208,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,
......
......@@ -4380,7 +4380,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);
}
}
......
......@@ -4695,6 +4695,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);
......@@ -4830,9 +4833,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)
{
......
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