[PATCH 1/4] wined3d: Add poll_in_cs field to wined3d_query().
Jan Sikorski
jsikorski at codeweavers.com
Fri Mar 4 11:12:56 CST 2022
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 at 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 b150f1ae097..ce297d724f2 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -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))
{
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 7b6c2325523..093b412bf18 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -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));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e21c4e6507b..b6f2cf060d4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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,
--
2.32.0
More information about the wine-devel
mailing list