aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/query_cache
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-29 04:40:26 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-29 20:49:47 -0400
commit1c2ed2a072ba24a3d21a25dfa6cfcce1bf1ae905 (patch)
tree9e6af4b3df6506c51b924cfe5b69caed1ca58471 /src/video_core/query_cache
parent06f294c7e6b305d5d8904d284de70c268cc3f2e0 (diff)
video_core: skip empty fences; one lock per cache per fence; single-pass overlap subtract
Switch 2 titles signal a fence for each compute dispatch's release (5,000-7,000 a second in title 1). With fast GPU fences the callback runs at once, so a fence with no downloads, queries or queued operations does nothing: those (~20%) are no longer made (one in 64 still is, for the operations fences carry). Each cache's lock is now taken once per fence (the flush check took both together first). The overlap range set's Subtract restarted its search after every erase (quadratic); the fencing thread runs it for every downloaded range while holding the buffer cache. The GPU profiler counts fences, skipped fences and buffer download bytes.
Diffstat (limited to 'src/video_core/query_cache')
-rw-r--r--src/video_core/query_cache/query_cache.h10
-rw-r--r--src/video_core/query_cache/query_cache_base.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h
index 245ab1996c..60ca50eb1f 100644
--- a/src/video_core/query_cache/query_cache.h
+++ b/src/video_core/query_cache/query_cache.h
@@ -520,6 +520,16 @@ bool QueryCacheBase<Traits>::HasUncommittedFlushes() const {
}
template <typename Traits>
+bool QueryCacheBase<Traits>::HasPendingFenceWork() const {
+ bool result = false;
+ impl->ForEachStreamer([&result](StreamerInterface* streamer) {
+ result |= streamer->HasUnsyncedQueries() || streamer->HasPendingSync();
+ return result;
+ });
+ return result;
+}
+
+template <typename Traits>
bool QueryCacheBase<Traits>::ShouldWaitAsyncFlushes() {
std::scoped_lock lk(impl->flush_guard);
return !impl->flushes_pending.empty() && impl->flushes_pending.front() != 0ULL;
diff --git a/src/video_core/query_cache/query_cache_base.h b/src/video_core/query_cache/query_cache_base.h
index d73e9039f7..5a60e42986 100644
--- a/src/video_core/query_cache/query_cache_base.h
+++ b/src/video_core/query_cache/query_cache_base.h
@@ -109,6 +109,9 @@ public:
bool HasUncommittedFlushes() const;
+ /// Whether a new fence has queries to flush or host writes to sync for this cache.
+ bool HasPendingFenceWork() const;
+
bool ShouldWaitAsyncFlushes();
void PopAsyncFlushes();