diff options
author | Markus Wick <markus@selfnet.de> | 2021-04-07 08:42:54 +0200 |
---|---|---|
committer | Markus Wick <markus@selfnet.de> | 2021-04-07 22:38:52 +0200 |
commit | 5145133a604f626c05f832465ac22019b003c32a (patch) | |
tree | 81aa729ab6897cadeb1251f6adcafaeab1010f0d /src/video_core/gpu_thread.cpp | |
parent | common/threadsafe_queue: Provide Wait() method. (diff) | |
download | yuzu-5145133a604f626c05f832465ac22019b003c32a.tar yuzu-5145133a604f626c05f832465ac22019b003c32a.tar.gz yuzu-5145133a604f626c05f832465ac22019b003c32a.tar.bz2 yuzu-5145133a604f626c05f832465ac22019b003c32a.tar.lz yuzu-5145133a604f626c05f832465ac22019b003c32a.tar.xz yuzu-5145133a604f626c05f832465ac22019b003c32a.tar.zst yuzu-5145133a604f626c05f832465ac22019b003c32a.zip |
Diffstat (limited to 'src/video_core/gpu_thread.cpp')
-rw-r--r-- | src/video_core/gpu_thread.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index cd59a7faf..6b8f06f78 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -68,13 +68,7 @@ ThreadManager::ThreadManager(Core::System& system_, bool is_async_) : system{system_}, is_async{is_async_} {} ThreadManager::~ThreadManager() { - if (!thread.joinable()) { - return; - } - - // Notify GPU thread that a shutdown is pending - PushCommand(EndProcessingCommand()); - thread.join(); + ShutDown(); } void ThreadManager::StartThread(VideoCore::RendererBase& renderer, @@ -132,10 +126,26 @@ void ThreadManager::FlushAndInvalidateRegion(VAddr addr, u64 size) { void ThreadManager::WaitIdle() const { while (state.last_fence > state.signaled_fence.load(std::memory_order_relaxed) && - system.IsPoweredOn()) { + state.is_running) { } } +void ThreadManager::ShutDown() { + if (!state.is_running) { + return; + } + + state.is_running = false; + + if (!thread.joinable()) { + return; + } + + // Notify GPU thread that a shutdown is pending + PushCommand(EndProcessingCommand()); + thread.join(); +} + void ThreadManager::OnCommandListEnd() { PushCommand(OnCommandListEndCommand()); } |