diff options
Diffstat (limited to 'src/video_core/fence_manager.h')
| -rw-r--r-- | src/video_core/fence_manager.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index ab20ff30f..805a89900 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h | |||
| @@ -55,6 +55,9 @@ public: | |||
| 55 | 55 | ||
| 56 | // Unlike other fences, this one doesn't | 56 | // Unlike other fences, this one doesn't |
| 57 | void SignalOrdering() { | 57 | void SignalOrdering() { |
| 58 | if constexpr (!can_async_check) { | ||
| 59 | TryReleasePendingFences<false>(); | ||
| 60 | } | ||
| 58 | std::scoped_lock lock{buffer_cache.mutex}; | 61 | std::scoped_lock lock{buffer_cache.mutex}; |
| 59 | buffer_cache.AccumulateFlushes(); | 62 | buffer_cache.AccumulateFlushes(); |
| 60 | } | 63 | } |
| @@ -104,9 +107,25 @@ public: | |||
| 104 | SignalFence(std::move(func)); | 107 | SignalFence(std::move(func)); |
| 105 | } | 108 | } |
| 106 | 109 | ||
| 107 | void WaitPendingFences() { | 110 | void WaitPendingFences([[maybe_unused]] bool force) { |
| 108 | if constexpr (!can_async_check) { | 111 | if constexpr (!can_async_check) { |
| 109 | TryReleasePendingFences<true>(); | 112 | TryReleasePendingFences<true>(); |
| 113 | } else { | ||
| 114 | if (!force) { | ||
| 115 | return; | ||
| 116 | } | ||
| 117 | std::mutex wait_mutex; | ||
| 118 | std::condition_variable wait_cv; | ||
| 119 | std::atomic<bool> wait_finished{}; | ||
| 120 | std::function<void()> func([&] { | ||
| 121 | std::scoped_lock lk(wait_mutex); | ||
| 122 | wait_finished.store(true, std::memory_order_relaxed); | ||
| 123 | wait_cv.notify_all(); | ||
| 124 | }); | ||
| 125 | SignalFence(std::move(func)); | ||
| 126 | std::unique_lock lk(wait_mutex); | ||
| 127 | wait_cv.wait( | ||
| 128 | lk, [&wait_finished] { return wait_finished.load(std::memory_order_relaxed); }); | ||
| 110 | } | 129 | } |
| 111 | } | 130 | } |
| 112 | 131 | ||