summaryrefslogtreecommitdiff
path: root/src/video_core/query_cache
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2023-08-04 13:38:49 +0200
committerGravatar Fernando Sahmkow2023-09-23 23:05:29 +0200
commitaa6587d854e4953876b02ca71278a665bcae8179 (patch)
treef2dafb0cda400fe1321f670c9eacc26051eca9aa /src/video_core/query_cache
parentMacro HLE: Add DrawIndirectByteCount (diff)
downloadyuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.gz
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.tar.xz
yuzu-aa6587d854e4953876b02ca71278a665bcae8179.zip
QueryCache: Implement dependant queries.
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 {
18 IsInvalidated = 1 << 6, ///< Indicates the value of th query has been nullified. 18 IsInvalidated = 1 << 6, ///< Indicates the value of th query has been nullified.
19 IsOrphan = 1 << 7, ///< Indicates the query has not been set by a guest query. 19 IsOrphan = 1 << 7, ///< Indicates the query has not been set by a guest query.
20 IsFence = 1 << 8, ///< Indicates the query is a fence. 20 IsFence = 1 << 8, ///< Indicates the query is a fence.
21 IsQueuedForAsyncFlush = 1 <<9,///< Indicates that the query can be flushed at any moment
21}; 22};
22DECLARE_ENUM_FLAG_OPERATORS(QueryFlagBits) 23DECLARE_ENUM_FLAG_OPERATORS(QueryFlagBits)
23 24
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() {
489 if (mask == 0) { 489 if (mask == 0) {
490 return; 490 return;
491 } 491 }
492 impl->ForEachStreamerIn(mask, 492 u64 ran_mask = 0;
493 [](StreamerInterface* streamer) { streamer->PopUnsyncedQueries(); }); 493 u64 next_phase = 0;
494 while (mask) {
495 impl->ForEachStreamerIn(mask, [&mask, &ran_mask, &next_phase](StreamerInterface* streamer) {
496 u64 dep_mask = streamer->GetDependenceMask();
497 if ((dep_mask & ~ran_mask) != 0) {
498 next_phase |= dep_mask;
499 return;
500 }
501 u64 index = streamer->GetId();
502 ran_mask |= (1ULL << index);
503 mask &= ~(1ULL << index);
504 streamer->PopUnsyncedQueries();
505 });
506 ran_mask |= next_phase;
507 }
494} 508}
495 509
496// Invalidation 510// 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:
70 return id; 70 return id;
71 } 71 }
72 72
73 u64 GetDependenceMask() const {
74 return dependance_mask;
75 }
76
73protected: 77protected:
74 const size_t id; 78 const size_t id;
75 const u64 dependance_mask; 79 const u64 dependance_mask;
@@ -78,7 +82,7 @@ protected:
78template <typename QueryType> 82template <typename QueryType>
79class SimpleStreamer : public StreamerInterface { 83class SimpleStreamer : public StreamerInterface {
80public: 84public:
81 SimpleStreamer(size_t id_) : StreamerInterface{id_} {} 85 SimpleStreamer(size_t id_, u64 dependance_mask_ = 0) : StreamerInterface{id_, dependance_mask_} {}
82 virtual ~SimpleStreamer() = default; 86 virtual ~SimpleStreamer() = default;
83 87
84protected: 88protected: