diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-13 21:52:13 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-13 21:53:58 +0100 |
commit | b8ffdbb1674e28b77b473d87f835dd052d8127ac (patch) | |
tree | d0f64d6304314256437af4325d755a726ba13def /src/video_core/renderer_vulkan | |
parent | Merge pull request #5921 from ameerj/srgb-views (diff) | |
download | yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar.gz yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar.bz2 yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar.lz yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar.xz yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.tar.zst yuzu-b8ffdbb1674e28b77b473d87f835dd052d8127ac.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_resource_pool.cpp | 14 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_resource_pool.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/video_core/renderer_vulkan/vk_resource_pool.cpp b/src/video_core/renderer_vulkan/vk_resource_pool.cpp index ee274ac59..a8bf7bda8 100644 --- a/src/video_core/renderer_vulkan/vk_resource_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_resource_pool.cpp @@ -17,21 +17,21 @@ ResourcePool::~ResourcePool() = default; size_t ResourcePool::CommitResource() { // Refresh semaphore to query updated results master_semaphore.Refresh(); - - const auto search = [this](size_t begin, size_t end) -> std::optional<size_t> { + const u64 gpu_tick = master_semaphore.KnownGpuTick(); + const auto search = [this, gpu_tick](size_t begin, size_t end) -> std::optional<size_t> { for (size_t iterator = begin; iterator < end; ++iterator) { - if (master_semaphore.IsFree(ticks[iterator])) { + if (gpu_tick >= ticks[iterator]) { ticks[iterator] = master_semaphore.CurrentTick(); return iterator; } } - return {}; + return std::nullopt; }; // Try to find a free resource from the hinted position to the end. - auto found = search(free_iterator, ticks.size()); + std::optional<size_t> found = search(hint_iterator, ticks.size()); if (!found) { // Search from beginning to the hinted position. - found = search(0, free_iterator); + found = search(0, hint_iterator); if (!found) { // Both searches failed, the pool is full; handle it. const size_t free_resource = ManageOverflow(); @@ -41,7 +41,7 @@ size_t ResourcePool::CommitResource() { } } // Free iterator is hinted to the resource after the one that's been commited. - free_iterator = (*found + 1) % ticks.size(); + hint_iterator = (*found + 1) % ticks.size(); return *found; } diff --git a/src/video_core/renderer_vulkan/vk_resource_pool.h b/src/video_core/renderer_vulkan/vk_resource_pool.h index a018c7ec2..9d0bb3b4d 100644 --- a/src/video_core/renderer_vulkan/vk_resource_pool.h +++ b/src/video_core/renderer_vulkan/vk_resource_pool.h @@ -36,7 +36,7 @@ private: MasterSemaphore& master_semaphore; size_t grow_step = 0; ///< Number of new resources created after an overflow - size_t free_iterator = 0; ///< Hint to where the next free resources is likely to be found + size_t hint_iterator = 0; ///< Hint to where the next free resources is likely to be found std::vector<u64> ticks; ///< Ticks for each resource }; |