Commit 9f85b5f8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Send resource maps through the command stream.

parent 4987ef49
......@@ -57,6 +57,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_QUERY_ISSUE,
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
WINED3D_CS_OP_MAP,
};
struct wined3d_cs_present
......@@ -289,6 +290,17 @@ struct wined3d_cs_unload_resource
struct wined3d_resource *resource;
};
struct wined3d_cs_map
{
enum wined3d_cs_op opcode;
struct wined3d_resource *resource;
unsigned int sub_resource_idx;
struct wined3d_map_desc *map_desc;
const struct wined3d_box *box;
DWORD flags;
HRESULT *hr;
};
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
......@@ -1301,6 +1313,35 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
cs->ops->submit(cs);
}
static void wined3d_cs_exec_map(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_map *op = data;
struct wined3d_resource *resource = op->resource;
*op->hr = resource->resource_ops->resource_sub_resource_map(resource,
op->sub_resource_idx, op->map_desc, op->box, op->flags);
}
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags)
{
struct wined3d_cs_map *op;
HRESULT hr;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
op->map_desc = map_desc;
op->box = box;
op->flags = flags;
op->hr = &hr;
cs->ops->submit(cs);
return hr;
}
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
......@@ -1334,6 +1375,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
......
......@@ -317,7 +317,7 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_desc, debug_box(box), flags);
return resource->resource_ops->resource_sub_resource_map(resource, sub_resource_idx, map_desc, box, flags);
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
}
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
......
......@@ -3096,6 +3096,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN;
static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants)
......
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