Re: [PATCH 3/5] wined3d: Store FLUSH flag in the query object.
On 6 September 2017 at 01:39, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
So it can be used in the CS thread's query polling. Passing the appropriate flag to glClientWaitSync() is potentially lighter on performance than a separate, explicit glFlush(). Maybe. It would be debatable once there are multiple queries in-flight.
@@ -389,8 +389,8 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, } else if (query->counter_main != query->counter_retrieved) { - if (flags & WINED3DGETDATA_FLUSH) - wined3d_cs_emit_flush(query->device->cs); + if (flags & WINED3DGETDATA_FLUSH && !(query->flags & WINED3DGETDATA_FLUSH)) + InterlockedExchange((LONG *)&query->flags, flags); Shouldn't the flag be cleared again when the query is restarted?
How about the following: - wined3d_query_get_data() emits a flush when the counters don't match, "flags" contains WINED3DGETDATA_FLUSH, and query->flushed is FALSE. - wined3d_cs_exec_flush() sets query->flushed for all queries on cs->query_poll_list. - query->flushed is cleared when a query is removed from cs->query_poll_list. Would that work? It would leave a small window between wined3d_cs_emit_flush() and wined3d_cs_exec_flush() that could probably be avoided by checking in wined3d_query_get_data() if any queries were issued since the last flush. Not sure whether that's worth it. Alternatively, we could only do the latter. I.e., set cs->queries_flushed in wined3d_cs_emit_flush(), and clear it in wined3d_cs_emit_query_issue(). That wouldn't prevent all redundant flushes, but it would help for applications calling wined3d_query_get_data() in a tight loop.
participants (1)
-
Henri Verbeet