diff options
author | Lioncash <mathew1800@gmail.com> | 2019-04-09 20:02:00 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-04-12 04:11:40 +0200 |
commit | 6d0551196d90af7f1233c655fd3b979811a14708 (patch) | |
tree | 9e91a2a79d5351360efaca57cc49be7801c7faf3 /src/video_core/gpu_thread.cpp | |
parent | core/cpu_core_manager: Create threads separately from initialization. (diff) | |
download | yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar.gz yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar.bz2 yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar.lz yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar.xz yuzu-6d0551196d90af7f1233c655fd3b979811a14708.tar.zst yuzu-6d0551196d90af7f1233c655fd3b979811a14708.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/gpu_thread.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index cc56cf467..c9a2077de 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -55,19 +55,24 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p } } -ThreadManager::ThreadManager(Core::System& system, VideoCore::RendererBase& renderer, - Tegra::DmaPusher& dma_pusher) - : system{system}, thread{RunThread, std::ref(renderer), std::ref(dma_pusher), std::ref(state)} { - synchronization_event = system.CoreTiming().RegisterEvent( - "GPUThreadSynch", [this](u64 fence, s64) { state.WaitForSynchronization(fence); }); -} +ThreadManager::ThreadManager(Core::System& system) : system{system} {} ThreadManager::~ThreadManager() { + if (!thread.joinable()) { + return; + } + // Notify GPU thread that a shutdown is pending PushCommand(EndProcessingCommand()); thread.join(); } +void ThreadManager::StartThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_pusher) { + thread = std::thread{RunThread, std::ref(renderer), std::ref(dma_pusher), std::ref(state)}; + synchronization_event = system.CoreTiming().RegisterEvent( + "GPUThreadSynch", [this](u64 fence, s64) { state.WaitForSynchronization(fence); }); +} + void ThreadManager::SubmitList(Tegra::CommandList&& entries) { const u64 fence{PushCommand(SubmitListCommand(std::move(entries)))}; const s64 synchronization_ticks{Core::Timing::usToCycles(9000)}; |