mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
core: fix initialization in single core, sync GPU mode
This commit is contained in:
parent
a33e7c13fa
commit
a6371fb69d
4 changed files with 13 additions and 0 deletions
|
@ -26,6 +26,7 @@ void CpuManager::ThreadStart(std::stop_token stop_token, CpuManager& cpu_manager
|
||||||
|
|
||||||
void CpuManager::Initialize() {
|
void CpuManager::Initialize() {
|
||||||
num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1;
|
num_cores = is_multicore ? Core::Hardware::NUM_CPU_CORES : 1;
|
||||||
|
gpu_barrier = std::make_unique<Common::Barrier>(num_cores + 1);
|
||||||
|
|
||||||
for (std::size_t core = 0; core < num_cores; core++) {
|
for (std::size_t core = 0; core < num_cores; core++) {
|
||||||
core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core);
|
core_data[core].host_thread = std::jthread(ThreadStart, std::ref(*this), core);
|
||||||
|
@ -230,6 +231,8 @@ void CpuManager::RunThread(std::size_t core) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Running
|
// Running
|
||||||
|
gpu_barrier->Sync();
|
||||||
|
|
||||||
if (!is_async_gpu && !is_multicore) {
|
if (!is_async_gpu && !is_multicore) {
|
||||||
system.GPU().ObtainContext();
|
system.GPU().ObtainContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,10 @@ public:
|
||||||
is_async_gpu = is_async;
|
is_async_gpu = is_async;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnGpuReady() {
|
||||||
|
gpu_barrier->Sync();
|
||||||
|
}
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
|
@ -81,6 +85,7 @@ private:
|
||||||
std::jthread host_thread;
|
std::jthread host_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<Common::Barrier> gpu_barrier{};
|
||||||
std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{};
|
std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{};
|
||||||
|
|
||||||
bool is_async_gpu{};
|
bool is_async_gpu{};
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
#include "core/cpu_manager.h"
|
||||||
#include "core/frontend/framebuffer_layout.h"
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
#include "input_common/drivers/keyboard.h"
|
#include "input_common/drivers/keyboard.h"
|
||||||
#include "input_common/drivers/mouse.h"
|
#include "input_common/drivers/mouse.h"
|
||||||
|
@ -73,6 +74,8 @@ void EmuThread::run() {
|
||||||
|
|
||||||
gpu.ReleaseContext();
|
gpu.ReleaseContext();
|
||||||
|
|
||||||
|
system.GetCpuManager().OnGpuReady();
|
||||||
|
|
||||||
// Holds whether the cpu was running during the last iteration,
|
// Holds whether the cpu was running during the last iteration,
|
||||||
// so that the DebugModeLeft signal can be emitted before the
|
// so that the DebugModeLeft signal can be emitted before the
|
||||||
// next execution step
|
// next execution step
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/telemetry.h"
|
#include "common/telemetry.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
#include "core/cpu_manager.h"
|
||||||
#include "core/crypto/key_manager.h"
|
#include "core/crypto/key_manager.h"
|
||||||
#include "core/file_sys/registered_cache.h"
|
#include "core/file_sys/registered_cache.h"
|
||||||
#include "core/file_sys/vfs_real.h"
|
#include "core/file_sys/vfs_real.h"
|
||||||
|
@ -216,6 +217,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
// Core is loaded, start the GPU (makes the GPU contexts current to this thread)
|
// Core is loaded, start the GPU (makes the GPU contexts current to this thread)
|
||||||
system.GPU().Start();
|
system.GPU().Start();
|
||||||
|
system.GetCpuManager().OnGpuReady();
|
||||||
|
|
||||||
if (Settings::values.use_disk_shader_cache.GetValue()) {
|
if (Settings::values.use_disk_shader_cache.GetValue()) {
|
||||||
system.Renderer().ReadRasterizer()->LoadDiskResources(
|
system.Renderer().ReadRasterizer()->LoadDiskResources(
|
||||||
|
|
Loading…
Reference in a new issue