diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.cpp | 11 | ||||
-rw-r--r-- | src/core/cpu_manager.cpp | 11 | ||||
-rw-r--r-- | src/core/cpu_manager.h | 14 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 032da7aa5..0f0eb885a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -152,8 +152,12 @@ struct System::Impl { device_memory = std::make_unique<Core::DeviceMemory>(system); - kernel.SetMulticore(Settings::values.use_multi_core); - cpu_manager.SetMulticore(Settings::values.use_multi_core); + is_multicore = Settings::values.use_multi_core; + is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation; + + kernel.SetMulticore(is_multicore); + cpu_manager.SetMulticore(is_multicore); + cpu_manager.SetAsyncGpu(is_async_gpu); core_timing.Initialize([&system]() { system.RegisterHostThread(); }); kernel.Initialize(); @@ -395,6 +399,9 @@ struct System::Impl { std::unique_ptr<Core::PerfStats> perf_stats; Core::FrameLimiter frame_limiter; + bool is_multicore{}; + bool is_async_gpu{}; + std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; }; diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index e92b0fb37..d7bd162bc 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -9,6 +9,7 @@ #include "core/core.h" #include "core/core_timing.h" #include "core/cpu_manager.h" +#include "core/frontend/emu_window.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/physical_core.h" @@ -21,7 +22,17 @@ 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) { + this->render_window = &render_window; } void CpuManager::Initialize() { diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h index c0e454a7d..37cef2b12 100644 --- a/src/core/cpu_manager.h +++ b/src/core/cpu_manager.h @@ -16,6 +16,10 @@ class Event; class Fiber; } // namespace Common +namespace Core::Frontend { +class EmuWindow; +} // namespace Core::Frontend + namespace Core { class System; @@ -35,6 +39,12 @@ public: void SetMulticore(bool is_multicore) { this->is_multicore = is_multicore; } + + /// Sets if emulation is using an asynchronous GPU. + void SetAsyncGpu(bool is_async_gpu) { + this->is_async_gpu = is_async_gpu; + } + void Initialize(); void Shutdown(); @@ -51,6 +61,8 @@ public: return current_core.load(); } + void SetRenderWindow(Core::Frontend::EmuWindow& render_window); + private: static void GuestThreadFunction(void* cpu_manager); static void GuestRewindFunction(void* cpu_manager); @@ -88,10 +100,12 @@ private: std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; + bool is_async_gpu{}; bool is_multicore{}; std::atomic<std::size_t> current_core{}; std::size_t preemption_count{}; static constexpr std::size_t max_cycle_runs = 5; + Core::Frontend::EmuWindow* render_window; System& system; }; |