Query Cachge: Fully rework Vulkan's query cache

This commit is contained in:
Fernando Sahmkow 2023-08-04 03:32:30 +02:00
parent bdc01254a9
commit f1a2e36711
35 changed files with 1573 additions and 355 deletions

View file

@ -104,9 +104,28 @@ public:
SignalFence(std::move(func));
}
void WaitPendingFences() {
void WaitPendingFences(bool force) {
if constexpr (!can_async_check) {
TryReleasePendingFences<true>();
if (force) {
TryReleasePendingFences<true>();
} else {
TryReleasePendingFences<false>();
}
} else {
if (!force) {
return;
}
std::mutex wait_mutex;
std::condition_variable wait_cv;
std::atomic<bool> wait_finished{};
std::function<void()> func([&] {
std::scoped_lock lk(wait_mutex);
wait_finished.store(true, std::memory_order_relaxed);
wait_cv.notify_all();
});
SignalFence(std::move(func));
std::unique_lock lk(wait_mutex);
wait_cv.wait(lk, [&wait_finished] { return wait_finished.load(std::memory_order_relaxed); });
}
}