From d03d201482b64b58db973a38576ab7df6cc1a328 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sat, 7 Sep 2019 16:13:10 -0600 Subject: [PATCH] Add GetRenderer to core --- src/core/core.cpp | 21 ++++++++++++++++----- src/core/core.h | 4 ++++ src/core/hw/gpu.cpp | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index c0dc93b559..5502d2e739 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -198,8 +198,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo timing = std::make_unique(); - kernel = std::make_unique(*memory, *timing, - [this] { PrepareReschedule(); }, system_mode); + kernel = std::make_unique( + *memory, *timing, [this] { PrepareReschedule(); }, system_mode); if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 @@ -237,9 +237,16 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo Service::Init(*this); GDBStub::Init(); - ResultStatus result = VideoCore::Init(emu_window, *memory); - if (result != ResultStatus::Success) { - return result; + VideoCore::ResultStatus result = VideoCore::Init(emu_window, *memory); + if (result != VideoCore::ResultStatus::Success) { + switch (result) { + case VideoCore::ResultStatus::ErrorGenericDrivers: + return ResultStatus::ErrorVideoCore_ErrorGenericDrivers; + case VideoCore::ResultStatus::ErrorBelowGL33: + return ResultStatus::ErrorVideoCore_ErrorBelowGL33; + default: + return ResultStatus::ErrorVideoCore; + } } #ifdef ENABLE_FFMPEG_VIDEO_DUMPER @@ -253,6 +260,10 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo return ResultStatus::Success; } +RendererBase& System::Renderer() { + return *VideoCore::g_renderer; +} + Service::SM::ServiceManager& System::ServiceManager() { return *service_manager; } diff --git a/src/core/core.h b/src/core/core.h index b533c4bc3e..5b79654537 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -55,6 +55,8 @@ namespace VideoDumper { class Backend; } +class RendererBase; + namespace Core { class Timing; @@ -170,6 +172,8 @@ public: return *dsp_core; } + RendererBase& Renderer(); + /** * Gets a reference to the service manager. * @returns A reference to the service manager. diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index b1e5f8a014..fcb60e6fec 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -11,6 +11,7 @@ #include "common/logging/log.h" #include "common/microprofile.h" #include "common/vector_math.h" +#include "core/core.h" #include "core/core_timing.h" #include "core/hle/service/gsp/gsp.h" #include "core/hw/gpu.h"