summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Morph2022-06-17 03:08:15 -0400
committerGravatar GitHub2022-06-17 03:08:15 -0400
commit5b2b15091f38eb169648ddad4ae32f03354d19cd (patch)
tree5da9f8475543baf027cb0885bb35f06258c48d06 /src/core
parentMerge pull request #8472 from german77/tace (diff)
parentcore: fix initialization in single core, sync GPU mode (diff)
downloadyuzu-5b2b15091f38eb169648ddad4ae32f03354d19cd.tar.gz
yuzu-5b2b15091f38eb169648ddad4ae32f03354d19cd.tar.xz
yuzu-5b2b15091f38eb169648ddad4ae32f03354d19cd.zip
Merge pull request #8476 from liamwhite/gpu-wasnt-ready
core: fix initialization in single core, sync GPU mode
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cpu_manager.cpp3
-rw-r--r--src/core/cpu_manager.h5
2 files changed, 8 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{};