summaryrefslogtreecommitdiffstats
path: root/src/video_core/query_cache
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-08-04 13:38:49 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-09-23 23:05:29 +0200
commitaa6587d854e4953876b02ca71278a665bcae8179 (patch)
treef2dafb0cda400fe1321f670c9eacc26051eca9aa /src/video_core/query_cache
parentMacro HLE: Add DrawIndirectByteCount (diff)
downloadyuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.gz
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.bz2
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.lz
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.xz
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.zst
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.zip
Diffstat (limited to 'src/video_core/query_cache')
-rw-r--r--src/video_core/query_cache/query_base.h1
-rw-r--r--src/video_core/query_cache/query_cache.h18
-rw-r--r--src/video_core/query_cache/query_stream.h6
3 files changed, 22 insertions, 3 deletions
diff --git a/src/video_core/query_cache/query_base.h b/src/video_core/query_cache/query_base.h
index 485ed669c..0ae23af9f 100644
--- a/src/video_core/query_cache/query_base.h
+++ b/src/video_core/query_cache/query_base.h
@@ -18,6 +18,7 @@ enum class QueryFlagBits : u32 {
IsInvalidated = 1 << 6, ///< Indicates the value of th query has been nullified.
IsOrphan = 1 << 7, ///< Indicates the query has not been set by a guest query.
IsFence = 1 << 8, ///< Indicates the query is a fence.
+ IsQueuedForAsyncFlush = 1 <<9,///< Indicates that the query can be flushed at any moment
};
DECLARE_ENUM_FLAG_OPERATORS(QueryFlagBits)
diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h
index f6af48d14..f1393d5c7 100644
--- a/src/video_core/query_cache/query_cache.h
+++ b/src/video_core/query_cache/query_cache.h
@@ -489,8 +489,22 @@ void QueryCacheBase<Traits>::PopAsyncFlushes() {
if (mask == 0) {
return;
}
- impl->ForEachStreamerIn(mask,
- [](StreamerInterface* streamer) { streamer->PopUnsyncedQueries(); });
+ u64 ran_mask = 0;
+ u64 next_phase = 0;
+ while (mask) {
+ impl->ForEachStreamerIn(mask, [&mask, &ran_mask, &next_phase](StreamerInterface* streamer) {
+ u64 dep_mask = streamer->GetDependenceMask();
+ if ((dep_mask & ~ran_mask) != 0) {
+ next_phase |= dep_mask;
+ return;
+ }
+ u64 index = streamer->GetId();
+ ran_mask |= (1ULL << index);
+ mask &= ~(1ULL << index);
+ streamer->PopUnsyncedQueries();
+ });
+ ran_mask |= next_phase;
+ }
}
// Invalidation
diff --git a/src/video_core/query_cache/query_stream.h b/src/video_core/query_cache/query_stream.h
index dd5f95b3c..0e9275565 100644
--- a/src/video_core/query_cache/query_stream.h
+++ b/src/video_core/query_cache/query_stream.h
@@ -70,6 +70,10 @@ public:
return id;
}
+ u64 GetDependenceMask() const {
+ return dependance_mask;
+ }
+
protected:
const size_t id;
const u64 dependance_mask;
@@ -78,7 +82,7 @@ protected:
template <typename QueryType>
class SimpleStreamer : public StreamerInterface {
public:
- SimpleStreamer(size_t id_) : StreamerInterface{id_} {}
+ SimpleStreamer(size_t id_, u64 dependance_mask_ = 0) : StreamerInterface{id_, dependance_mask_} {}
virtual ~SimpleStreamer() = default;
protected: