wined3d: Issue queries 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:
Henri Verbeet 2016-07-29 12:34:34 +02:00 committed by Alexandre Julliard
parent 18d60012e8
commit 7cda73e818
3 changed files with 31 additions and 1 deletions

View File

@ -54,6 +54,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_SET_MATERIAL,
WINED3D_CS_OP_RESET_STATE, WINED3D_CS_OP_RESET_STATE,
WINED3D_CS_OP_DESTROY_OBJECT, WINED3D_CS_OP_DESTROY_OBJECT,
WINED3D_CS_OP_QUERY_ISSUE,
}; };
struct wined3d_cs_present struct wined3d_cs_present
@ -267,6 +268,13 @@ struct wined3d_cs_destroy_object
void *object; void *object;
}; };
struct wined3d_cs_query_issue
{
enum wined3d_cs_op opcode;
struct wined3d_query *query;
DWORD flags;
};
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{ {
const struct wined3d_cs_present *op = data; const struct wined3d_cs_present *op = data;
@ -1215,6 +1223,26 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
cs->ops->submit(cs); cs->ops->submit(cs);
} }
static void wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_query_issue *op = data;
struct wined3d_query *query = op->query;
query->query_ops->query_issue(query, op->flags);
}
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
{
struct wined3d_cs_query_issue *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
op->query = query;
op->flags = flags;
cs->ops->submit(cs);
}
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{ {
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present, /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
@ -1245,6 +1273,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state, /* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object, /* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
}; };
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size) static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)

View File

@ -350,7 +350,7 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
{ {
TRACE("query %p, flags %#x.\n", query, flags); TRACE("query %p, flags %#x.\n", query, flags);
query->query_ops->query_issue(query, flags); wined3d_cs_emit_query_issue(query->device->cs, query, flags);
if (flags & WINED3DISSUE_BEGIN) if (flags & WINED3DISSUE_BEGIN)
query->state = QUERY_BUILDING; query->state = QUERY_BUILDING;

View File

@ -3041,6 +3041,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN; unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN; const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx,
const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;