summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-03-31 13:52:07 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:36:03 -0400
commit54e304fe2a38984ea27a7f2240c41a85931d7f6b (patch)
treea05917e949a1da864c060aec6b874a58af87e244 /src
parentHLE_IPC: Correct HLE Event behavior on timeout. (diff)
downloadyuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.gz
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.tar.xz
yuzu-54e304fe2a38984ea27a7f2240c41a85931d7f6b.zip
Bootmanager/CPU_Manager: Correct shader caches and sync GPU on OpenGL.
Diffstat (limited to 'src')
-rw-r--r--src/core/cpu_manager.cpp15
-rw-r--r--src/yuzu/bootmanager.cpp4
2 files changed, 13 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} {}
22CpuManager::~CpuManager() = default; 22CpuManager::~CpuManager() = default;
23 23
24void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) { 24void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) {
25 if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
26 cpu_manager.render_window->MakeCurrent();
27 }
28 cpu_manager.RunThread(core); 25 cpu_manager.RunThread(core);
29 if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) {
30 cpu_manager.render_window->DoneCurrent();
31 }
32} 26}
33 27
34void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) { 28void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) {
@@ -353,10 +347,16 @@ void CpuManager::RunThread(std::size_t core) {
353 data.host_context = Common::Fiber::ThreadToFiber(); 347 data.host_context = Common::Fiber::ThreadToFiber();
354 data.is_running = false; 348 data.is_running = false;
355 data.initialized = true; 349 data.initialized = true;
350 const bool sc_sync = !is_async_gpu && !is_multicore;
351 bool sc_sync_first_use = sc_sync;
356 /// Running 352 /// Running
357 while (running_mode) { 353 while (running_mode) {
358 data.is_running = false; 354 data.is_running = false;
359 data.enter_barrier->Wait(); 355 data.enter_barrier->Wait();
356 if (sc_sync_first_use) {
357 render_window->MakeCurrent();
358 sc_sync_first_use = false;
359 }
360 auto& scheduler = system.Kernel().CurrentScheduler(); 360 auto& scheduler = system.Kernel().CurrentScheduler();
361 Kernel::Thread* current_thread = scheduler.GetCurrentThread(); 361 Kernel::Thread* current_thread = scheduler.GetCurrentThread();
362 data.is_running = true; 362 data.is_running = true;
@@ -366,6 +366,9 @@ void CpuManager::RunThread(std::size_t core) {
366 data.exit_barrier->Wait(); 366 data.exit_barrier->Wait();
367 data.is_paused = false; 367 data.is_paused = false;
368 } 368 }
369 if (sc_sync) {
370 render_window->DoneCurrent();
371 }
369 /// Time to cleanup 372 /// Time to cleanup
370 data.host_context->Exit(); 373 data.host_context->Exit();
371 data.enter_barrier.reset(); 374 data.enter_barrier.reset();
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 6fad01d50..6aa161e99 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -56,6 +56,8 @@ void EmuThread::run() {
56 56
57 Core::System::GetInstance().RegisterHostThread(); 57 Core::System::GetInstance().RegisterHostThread();
58 58
59 context.MakeCurrent();
60
59 Core::System::GetInstance().Renderer().Rasterizer().LoadDiskResources( 61 Core::System::GetInstance().Renderer().Rasterizer().LoadDiskResources(
60 stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) { 62 stop_run, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
61 emit LoadProgress(stage, value, total); 63 emit LoadProgress(stage, value, total);
@@ -63,6 +65,8 @@ void EmuThread::run() {
63 65
64 emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0); 66 emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);
65 67
68 context.DoneCurrent();
69
66 // Holds whether the cpu was running during the last iteration, 70 // Holds whether the cpu was running during the last iteration,
67 // so that the DebugModeLeft signal can be emitted before the 71 // so that the DebugModeLeft signal can be emitted before the
68 // next execution step 72 // next execution step