diff options
Diffstat (limited to 'src/video_core/fence_manager.h')
| -rw-r--r-- | src/video_core/fence_manager.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index ab20ff30f..8459a3092 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h | |||
| @@ -104,9 +104,28 @@ public: | |||
| 104 | SignalFence(std::move(func)); | 104 | SignalFence(std::move(func)); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | void WaitPendingFences() { | 107 | void WaitPendingFences(bool force) { |
| 108 | if constexpr (!can_async_check) { | 108 | if constexpr (!can_async_check) { |
| 109 | TryReleasePendingFences<true>(); | 109 | if (force) { |
| 110 | TryReleasePendingFences<true>(); | ||
| 111 | } else { | ||
| 112 | TryReleasePendingFences<false>(); | ||
| 113 | } | ||
| 114 | } else { | ||
| 115 | if (!force) { | ||
| 116 | return; | ||
| 117 | } | ||
| 118 | std::mutex wait_mutex; | ||
| 119 | std::condition_variable wait_cv; | ||
| 120 | std::atomic<bool> wait_finished{}; | ||
| 121 | std::function<void()> func([&] { | ||
| 122 | std::scoped_lock lk(wait_mutex); | ||
| 123 | wait_finished.store(true, std::memory_order_relaxed); | ||
| 124 | wait_cv.notify_all(); | ||
| 125 | }); | ||
| 126 | SignalFence(std::move(func)); | ||
| 127 | std::unique_lock lk(wait_mutex); | ||
| 128 | wait_cv.wait(lk, [&wait_finished] { return wait_finished.load(std::memory_order_relaxed); }); | ||
| 110 | } | 129 | } |
| 111 | } | 130 | } |
| 112 | 131 | ||