QueryCache: Implement dependant queries.
This commit is contained in:
		| @@ -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) | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Fernando Sahmkow
					Fernando Sahmkow