Commit 92045690 authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

wined3d: Add poll_in_cs field to wined3d_query().

Its eventual purpose is to allow for skipping the poll list mechanism by calling query_poll() in the application thread. In this patch it is only used for when we don't have a separate CS thread. Signed-off-by: 's avatarJan Sikorski <jsikorski@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a58483c9
......@@ -2312,8 +2312,12 @@ static void wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
poll = query->query_ops->query_issue(query, op->flags);
if (!cs->thread)
if (!query->poll_in_cs)
{
if (op->flags & WINED3DISSUE_END)
InterlockedIncrement(&query->counter_retrieved);
return;
}
if (poll && list_empty(&query->poll_list_entry))
{
......
......@@ -143,6 +143,7 @@ static void wined3d_query_init(struct wined3d_query *query, struct wined3d_devic
query->data = data;
query->data_size = data_size;
query->query_ops = query_ops;
query->poll_in_cs = !!device->cs->thread;
list_init(&query->poll_list_entry);
}
......@@ -469,23 +470,21 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
return WINED3DERR_INVALIDCALL;
}
if (query->device->cs->thread)
if (query->counter_main != query->counter_retrieved
|| (query->buffer_object && !wined3d_query_buffer_is_valid(query)))
{
if (query->counter_main != query->counter_retrieved
|| (query->buffer_object && !wined3d_query_buffer_is_valid(query)))
{
if (flags & WINED3DGETDATA_FLUSH && !query->device->cs->queries_flushed)
query->device->cs->c.ops->flush(&query->device->cs->c);
return S_FALSE;
}
if (query->buffer_object)
query->data = query->map_ptr;
if (flags & WINED3DGETDATA_FLUSH && !query->device->cs->queries_flushed)
query->device->cs->c.ops->flush(&query->device->cs->c);
return S_FALSE;
}
else if (!query->query_ops->query_poll(query, flags))
else if (!query->poll_in_cs && !query->query_ops->query_poll(query, flags))
{
return S_FALSE;
}
if (query->buffer_object)
query->data = query->map_ptr;
if (data)
memcpy(data, query->data, min(data_size, query->data_size));
......
......@@ -1955,6 +1955,7 @@ struct wined3d_query
GLuint buffer_object;
UINT64 *map_ptr;
bool poll_in_cs;
};
HRESULT wined3d_query_gl_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent,
......
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