diff options
| author | 2020-03-15 21:34:22 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:52 -0400 | |
| commit | 5d3a2be04f265c2d6a8687431593029f7329060f (patch) | |
| tree | fa4475df8c0d09aa9e3fe92c6e9ed8dcb5bc267f /src/core | |
| parent | ARM: Addapt to new Exclusive Monitor Interface. (diff) | |
| download | yuzu-5d3a2be04f265c2d6a8687431593029f7329060f.tar.gz yuzu-5d3a2be04f265c2d6a8687431593029f7329060f.tar.xz yuzu-5d3a2be04f265c2d6a8687431593029f7329060f.zip | |
GUI: Make multicore only work with Async and add GUI for multicore.
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 { | |||
| 152 | 152 | ||
| 153 | device_memory = std::make_unique<Core::DeviceMemory>(system); | 153 | device_memory = std::make_unique<Core::DeviceMemory>(system); |
| 154 | 154 | ||
| 155 | kernel.SetMulticore(Settings::values.use_multi_core); | 155 | is_multicore = Settings::values.use_multi_core; |
| 156 | cpu_manager.SetMulticore(Settings::values.use_multi_core); | 156 | is_async_gpu = is_multicore || Settings::values.use_asynchronous_gpu_emulation; |
| 157 | |||
| 158 | kernel.SetMulticore(is_multicore); | ||
| 159 | cpu_manager.SetMulticore(is_multicore); | ||
| 160 | cpu_manager.SetAsyncGpu(is_async_gpu); | ||
| 157 | 161 | ||
| 158 | core_timing.Initialize([&system]() { system.RegisterHostThread(); }); | 162 | core_timing.Initialize([&system]() { system.RegisterHostThread(); }); |
| 159 | kernel.Initialize(); | 163 | kernel.Initialize(); |
| @@ -395,6 +399,9 @@ struct System::Impl { | |||
| 395 | std::unique_ptr<Core::PerfStats> perf_stats; | 399 | std::unique_ptr<Core::PerfStats> perf_stats; |
| 396 | Core::FrameLimiter frame_limiter; | 400 | Core::FrameLimiter frame_limiter; |
| 397 | 401 | ||
| 402 | bool is_multicore{}; | ||
| 403 | bool is_async_gpu{}; | ||
| 404 | |||
| 398 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; | 405 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; |
| 399 | }; | 406 | }; |
| 400 | 407 | ||
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 @@ | |||
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/core_timing.h" | 10 | #include "core/core_timing.h" |
| 11 | #include "core/cpu_manager.h" | 11 | #include "core/cpu_manager.h" |
| 12 | #include "core/frontend/emu_window.h" | ||
| 12 | #include "core/gdbstub/gdbstub.h" | 13 | #include "core/gdbstub/gdbstub.h" |
| 13 | #include "core/hle/kernel/kernel.h" | 14 | #include "core/hle/kernel/kernel.h" |
| 14 | #include "core/hle/kernel/physical_core.h" | 15 | #include "core/hle/kernel/physical_core.h" |
| @@ -21,7 +22,17 @@ CpuManager::CpuManager(System& system) : system{system} {} | |||
| 21 | CpuManager::~CpuManager() = default; | 22 | CpuManager::~CpuManager() = default; |
| 22 | 23 | ||
| 23 | void CpuManager::ThreadStart(CpuManager& cpu_manager, std::size_t core) { | 24 | void 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 | } | ||
| 24 | cpu_manager.RunThread(core); | 28 | cpu_manager.RunThread(core); |
| 29 | if (!cpu_manager.is_async_gpu && !cpu_manager.is_multicore) { | ||
| 30 | cpu_manager.render_window->DoneCurrent(); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | void CpuManager::SetRenderWindow(Core::Frontend::EmuWindow& render_window) { | ||
| 35 | this->render_window = &render_window; | ||
| 25 | } | 36 | } |
| 26 | 37 | ||
| 27 | void CpuManager::Initialize() { | 38 | 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; | |||
| 16 | class Fiber; | 16 | class Fiber; |
| 17 | } // namespace Common | 17 | } // namespace Common |
| 18 | 18 | ||
| 19 | namespace Core::Frontend { | ||
| 20 | class EmuWindow; | ||
| 21 | } // namespace Core::Frontend | ||
| 22 | |||
| 19 | namespace Core { | 23 | namespace Core { |
| 20 | 24 | ||
| 21 | class System; | 25 | class System; |
| @@ -35,6 +39,12 @@ public: | |||
| 35 | void SetMulticore(bool is_multicore) { | 39 | void SetMulticore(bool is_multicore) { |
| 36 | this->is_multicore = is_multicore; | 40 | this->is_multicore = is_multicore; |
| 37 | } | 41 | } |
| 42 | |||
| 43 | /// Sets if emulation is using an asynchronous GPU. | ||
| 44 | void SetAsyncGpu(bool is_async_gpu) { | ||
| 45 | this->is_async_gpu = is_async_gpu; | ||
| 46 | } | ||
| 47 | |||
| 38 | void Initialize(); | 48 | void Initialize(); |
| 39 | void Shutdown(); | 49 | void Shutdown(); |
| 40 | 50 | ||
| @@ -51,6 +61,8 @@ public: | |||
| 51 | return current_core.load(); | 61 | return current_core.load(); |
| 52 | } | 62 | } |
| 53 | 63 | ||
| 64 | void SetRenderWindow(Core::Frontend::EmuWindow& render_window); | ||
| 65 | |||
| 54 | private: | 66 | private: |
| 55 | static void GuestThreadFunction(void* cpu_manager); | 67 | static void GuestThreadFunction(void* cpu_manager); |
| 56 | static void GuestRewindFunction(void* cpu_manager); | 68 | static void GuestRewindFunction(void* cpu_manager); |
| @@ -88,10 +100,12 @@ private: | |||
| 88 | 100 | ||
| 89 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; | 101 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; |
| 90 | 102 | ||
| 103 | bool is_async_gpu{}; | ||
| 91 | bool is_multicore{}; | 104 | bool is_multicore{}; |
| 92 | std::atomic<std::size_t> current_core{}; | 105 | std::atomic<std::size_t> current_core{}; |
| 93 | std::size_t preemption_count{}; | 106 | std::size_t preemption_count{}; |
| 94 | static constexpr std::size_t max_cycle_runs = 5; | 107 | static constexpr std::size_t max_cycle_runs = 5; |
| 108 | Core::Frontend::EmuWindow* render_window; | ||
| 95 | 109 | ||
| 96 | System& system; | 110 | System& system; |
| 97 | }; | 111 | }; |