wined3d: Send resource unmaps through the command stream.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9f85b5f867
commit
66e54fd682
|
@ -58,6 +58,7 @@ enum wined3d_cs_op
|
|||
WINED3D_CS_OP_PRELOAD_RESOURCE,
|
||||
WINED3D_CS_OP_UNLOAD_RESOURCE,
|
||||
WINED3D_CS_OP_MAP,
|
||||
WINED3D_CS_OP_UNMAP,
|
||||
};
|
||||
|
||||
struct wined3d_cs_present
|
||||
|
@ -301,6 +302,14 @@ struct wined3d_cs_map
|
|||
HRESULT *hr;
|
||||
};
|
||||
|
||||
struct wined3d_cs_unmap
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int sub_resource_idx;
|
||||
HRESULT *hr;
|
||||
};
|
||||
|
||||
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_present *op = data;
|
||||
|
@ -1342,6 +1351,30 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_unmap(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_unmap *op = data;
|
||||
struct wined3d_resource *resource = op->resource;
|
||||
|
||||
*op->hr = resource->resource_ops->resource_sub_resource_unmap(resource, op->sub_resource_idx);
|
||||
}
|
||||
|
||||
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx)
|
||||
{
|
||||
struct wined3d_cs_unmap *op;
|
||||
HRESULT hr;
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op));
|
||||
op->opcode = WINED3D_CS_OP_UNMAP;
|
||||
op->resource = resource;
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
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,
|
||||
|
@ -1376,6 +1409,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
|||
/* 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,
|
||||
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
|
||||
};
|
||||
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
|
||||
|
|
|
@ -324,7 +324,7 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
|
|||
{
|
||||
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
|
||||
|
||||
return resource->resource_ops->resource_sub_resource_unmap(resource, sub_resource_idx);
|
||||
return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx);
|
||||
}
|
||||
|
||||
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
|
||||
|
|
|
@ -3098,6 +3098,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
|
|||
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;
|
||||
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx) 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)
|
||||
|
|
Loading…
Reference in New Issue