summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/cpu_manager.cpp3
-rw-r--r--src/core/cpu_manager.h5
-rw-r--r--src/yuzu/bootmanager.cpp3
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
4 files changed, 13 insertions, 0 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index 1c07dc90e..d69b2602a 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -26,6 +26,7 @@ void CpuManager::ThreadStart(std::stop_token stop_token, CpuManager& cpu_manager
26 26
27void CpuManager::Initialize() { 27void CpuManager::Initialize() {
28 num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1; 28 num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1;
29 gpu_barrier = std::make_unique<Common::Barrier>(num_cores + 1);
29 30
30 for (std::size_t core = 0; core < num_cores; core++) { 31 for (std::size_t core = 0; core < num_cores; core++) {
31 core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core); 32 core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core);
@@ -230,6 +231,8 @@ void CpuManager::RunThread(std::size_t core) {
230 }); 231 });
231 232
232 // Running 233 // Running
234 gpu_barrier->Sync();
235
233 if (!is_async_gpu && !is_multicore) { 236 if (!is_async_gpu && !is_multicore) {
234 system.GPU().ObtainContext(); 237 system.GPU().ObtainContext();
235 } 238 }
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h
index 681bdaf19..f0751fc58 100644
--- a/src/core/cpu_manager.h
+++ b/src/core/cpu_manager.h
@@ -43,6 +43,10 @@ public:
43 is_async_gpu = is_async; 43 is_async_gpu = is_async;
44 } 44 }
45 45
46 void OnGpuReady() {
47 gpu_barrier->Sync();
48 }
49
46 void Initialize(); 50 void Initialize();
47 void Shutdown(); 51 void Shutdown();
48 52
@@ -81,6 +85,7 @@ private:
81 std::jthread host_thread; 85 std::jthread host_thread;
82 }; 86 };
83 87
88 std::unique_ptr<Common::Barrier> gpu_barrier{};
84 std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; 89 std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{};
85 90
86 bool is_async_gpu{}; 91 bool is_async_gpu{};
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index cbe4e2daa..01acda22b 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -29,6 +29,7 @@
29#include "common/scm_rev.h" 29#include "common/scm_rev.h"
30#include "common/settings.h" 30#include "common/settings.h"
31#include "core/core.h" 31#include "core/core.h"
32#include "core/cpu_manager.h"
32#include "core/frontend/framebuffer_layout.h" 33#include "core/frontend/framebuffer_layout.h"
33#include "input_common/drivers/keyboard.h" 34#include "input_common/drivers/keyboard.h"
34#include "input_common/drivers/mouse.h" 35#include "input_common/drivers/mouse.h"
@@ -73,6 +74,8 @@ void EmuThread::run() {
73 74
74 gpu.ReleaseContext(); 75 gpu.ReleaseContext();
75 76
77 system.GetCpuManager().OnGpuReady();
78
76 // Holds whether the cpu was running during the last iteration, 79 // Holds whether the cpu was running during the last iteration,
77 // so that the DebugModeLeft signal can be emitted before the 80 // so that the DebugModeLeft signal can be emitted before the
78 // next execution step 81 // next execution step
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index e840732e2..cb301e78b 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -21,6 +21,7 @@
21#include "common/string_util.h" 21#include "common/string_util.h"
22#include "common/telemetry.h" 22#include "common/telemetry.h"
23#include "core/core.h" 23#include "core/core.h"
24#include "core/cpu_manager.h"
24#include "core/crypto/key_manager.h" 25#include "core/crypto/key_manager.h"
25#include "core/file_sys/registered_cache.h" 26#include "core/file_sys/registered_cache.h"
26#include "core/file_sys/vfs_real.h" 27#include "core/file_sys/vfs_real.h"
@@ -216,6 +217,7 @@ int main(int argc, char** argv) {
216 217
217 // Core is loaded, start the GPU (makes the GPU contexts current to this thread) 218 // Core is loaded, start the GPU (makes the GPU contexts current to this thread)
218 system.GPU().Start(); 219 system.GPU().Start();
220 system.GetCpuManager().OnGpuReady();
219 221
220 if (Settings::values.use_disk_shader_cache.GetValue()) { 222 if (Settings::values.use_disk_shader_cache.GetValue()) {
221 system.Renderer().ReadRasterizer()->LoadDiskResources( 223 system.Renderer().ReadRasterizer()->LoadDiskResources(