summaryrefslogtreecommitdiffstats
path: root/src/core/cpu_manager.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-31 19:52:07 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:36:03 +0200
commit54e304fe2a38984ea27a7f2240c41a85931d7f6b (patch)
treea05917e949a1da864c060aec6b874a58af87e244 /src/core/cpu_manager.cpp
parentHLE_IPC: Correct HLE Event behavior on timeout. (diff)
downloadyuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.gz
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.bz2
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.lz
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.xz
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.zst
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.zip
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r--src/core/cpu_manager.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index d604aa446..c0974ee38 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -22,13 +22,7 @@ CpuManager::CpuManager(System& system) : system{system} {}
CpuManager::~CpuManager() = default;
void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
- if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
- cpu_manager.render_window->MakeCurrent();
- }
cpu_manager.RunThread(core);
- if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
- cpu_manager.render_window->DoneCurrent();
- }
}
void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) {
@@ -353,10 +347,16 @@ void CpuManager::RunThread(std::size_t core) {
data.host_context = Common::Fiber::ThreadToFiber();
data.is_running = false;
data.initialized = true;
+ const bool sc_sync = !is_async_gpu && !is_multicore;
+ bool sc_sync_first_use = sc_sync;
/// Running
while (running_mode) {
data.is_running = false;
data.enter_barrier->Wait();
+ if (sc_sync_first_use) {
+ render_window->MakeCurrent();
+ sc_sync_first_use = false;
+ }
auto& scheduler = system.Kernel().CurrentScheduler();
Kernel::Thread* current_thread = scheduler.GetCurrentThread();
data.is_running = true;
@@ -366,6 +366,9 @@ void CpuManager::RunThread(std::size_t core) {
data.exit_barrier->Wait();
data.is_paused = false;
}
+ if (sc_sync) {
+ render_window->DoneCurrent();
+ }
/// Time to cleanup
data.host_context->Exit();
data.enter_barrier.reset();