diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-06-11 05:58:57 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-08-22 06:51:45 +0200 |
commit | da53bcee60fced902479b72b40ed26b099fa9938 (patch) | |
tree | b83232ad60b7725090b31bd3e347c9df774ced40 /src/video_core/video_core.cpp | |
parent | Merge pull request #4536 from lioncash/semi3 (diff) | |
download | yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar.gz yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar.bz2 yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar.lz yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar.xz yuzu-da53bcee60fced902479b72b40ed26b099fa9938.tar.zst yuzu-da53bcee60fced902479b72b40ed26b099fa9938.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/video_core.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 45f360bdd..4e3a092c7 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <memory> + #include "common/logging/log.h" #include "core/core.h" #include "core/settings.h" @@ -16,37 +17,46 @@ #include "video_core/video_core.h" namespace { -std::unique_ptr<VideoCore::RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window, - Core::System& system, - Core::Frontend::GraphicsContext& context) { + +std::unique_ptr<VideoCore::RendererBase> CreateRenderer( + Core::System& system, Core::Frontend::EmuWindow& emu_window, Tegra::GPU& gpu, + std::unique_ptr<Core::Frontend::GraphicsContext> context) { switch (Settings::values.renderer_backend.GetValue()) { case Settings::RendererBackend::OpenGL: - return std::make_unique<OpenGL::RendererOpenGL>(emu_window, system, context); + return std::make_unique<OpenGL::RendererOpenGL>(system, emu_window, gpu, + std::move(context)); #ifdef HAS_VULKAN case Settings::RendererBackend::Vulkan: - return std::make_unique<Vulkan::RendererVulkan>(emu_window, system); + return std::make_unique<Vulkan::RendererVulkan>(system, emu_window, gpu, + std::move(context)); #endif default: return nullptr; } } + } // Anonymous namespace namespace VideoCore { std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Core::System& system) { + std::unique_ptr<Tegra::GPU> gpu; + if (Settings::values.use_asynchronous_gpu_emulation.GetValue()) { + gpu = std::make_unique<VideoCommon::GPUAsynch>(system); + } else { + gpu = std::make_unique<VideoCommon::GPUSynch>(system); + } + auto context = emu_window.CreateSharedContext(); const auto scope = context->Acquire(); - auto renderer = CreateRenderer(emu_window, system, *context); + + auto renderer = CreateRenderer(system, emu_window, *gpu, std::move(context)); if (!renderer->Init()) { return nullptr; } - if (Settings::values.use_asynchronous_gpu_emulation.GetValue()) { - return std::make_unique<VideoCommon::GPUAsynch>(system, std::move(renderer), - std::move(context)); - } - return std::make_unique<VideoCommon::GPUSynch>(system, std::move(renderer), std::move(context)); + gpu->BindRenderer(std::move(renderer)); + return gpu; } u16 GetResolutionScaleFactor(const RendererBase& renderer) { |