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: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/cs.c | 6 +++++- dlls/wined3d/query.c | 21 ++++++++++----------- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 9bdd2c8ed98..e27b5b37aa4 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2396,8 +2396,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)) { diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 1b38eb5e311..77999c62ab1 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -146,6 +146,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); }
@@ -472,23 +473,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));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 2fce585c6b1..d1136599319 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1973,6 +1973,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,