diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-09-19 22:15:02 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-09-20 21:29:41 +0200 |
commit | 7003090187e02c8625f4eb7a024ac97f9b0159aa (patch) | |
tree | b38f399967df79eb7c0dc711508cd54b7c9bf62e /src/yuzu_cmd | |
parent | Merge pull request #4643 from FearlessTobi/decrease-pad-update-interval (diff) | |
download | yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar.gz yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar.bz2 yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar.lz yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar.xz yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.tar.zst yuzu-7003090187e02c8625f4eb7a024ac97f9b0159aa.zip |
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 5 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.h | 9 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 15 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h | 5 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | 9 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h | 7 | ||||
-rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 7 |
7 files changed, 12 insertions, 45 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index a804d5185..521209622 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -13,9 +13,8 @@ #include "input_common/sdl/sdl.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h" -EmuWindow_SDL2::EmuWindow_SDL2(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem_) - : system{system}, input_subsystem{input_subsystem_} { +EmuWindow_SDL2::EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_) + : input_subsystem{input_subsystem_} { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); exit(1); diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h index 82750ffec..53d756c3c 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h @@ -20,8 +20,7 @@ class InputSubsystem; class EmuWindow_SDL2 : public Core::Frontend::EmuWindow { public: - explicit EmuWindow_SDL2(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem); + explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem); ~EmuWindow_SDL2(); /// Polls window events @@ -33,9 +32,6 @@ public: /// Returns if window is shown (not minimized) bool IsShown() const override; - /// Presents the next frame - virtual void Present() = 0; - protected: /// Called by PollEvents when a key is pressed or released. void OnKeyEvent(int key, u8 state); @@ -67,9 +63,6 @@ protected: /// Called when a configuration change affects the minimal size of the window void OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) override; - /// Instance of the system, used to access renderer for the presentation thread - Core::System& system; - /// Is the window still open? bool is_open = true; diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 881b67a76..5f35233b5 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -87,9 +87,8 @@ bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() { return unsupported_ext.empty(); } -EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem) - : EmuWindow_SDL2{system, fullscreen, input_subsystem} { +EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, bool fullscreen) + : EmuWindow_SDL2{input_subsystem} { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); @@ -163,13 +162,3 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() { std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const { return std::make_unique<SDLGLContext>(); } - -void EmuWindow_SDL2_GL::Present() { - SDL_GL_MakeCurrent(render_window, window_context); - SDL_GL_SetSwapInterval(Settings::values.use_vsync.GetValue() ? 1 : 0); - while (IsOpen()) { - system.Renderer().TryPresent(100); - SDL_GL_SwapWindow(render_window); - } - SDL_GL_MakeCurrent(render_window, nullptr); -} diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h index 732a64edd..dba5c293c 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h @@ -14,12 +14,9 @@ class InputSubsystem; class EmuWindow_SDL2_GL final : public EmuWindow_SDL2 { public: - explicit EmuWindow_SDL2_GL(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem); + explicit EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsystem, bool fullscreen); ~EmuWindow_SDL2_GL(); - void Present() override; - std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; private: diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp index 53491f86e..3ba657c00 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp @@ -19,9 +19,8 @@ #include <SDL.h> #include <SDL_syswm.h> -EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem) - : EmuWindow_SDL2{system, fullscreen, input_subsystem} { +EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem) + : EmuWindow_SDL2{input_subsystem} { const std::string window_title = fmt::format("yuzu {} | {}-{} (Vulkan)", Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc); render_window = @@ -74,7 +73,3 @@ EmuWindow_SDL2_VK::~EmuWindow_SDL2_VK() = default; std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_VK::CreateSharedContext() const { return std::make_unique<DummyContext>(); } - -void EmuWindow_SDL2_VK::Present() { - // TODO (bunnei): ImplementMe -} diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h index f99704d4c..bdfdc3c6f 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h @@ -19,11 +19,8 @@ class InputSubsystem; class EmuWindow_SDL2_VK final : public EmuWindow_SDL2 { public: - explicit EmuWindow_SDL2_VK(Core::System& system, bool fullscreen, - InputCommon::InputSubsystem* input_subsystem); - ~EmuWindow_SDL2_VK(); - - void Present() override; + explicit EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem); + ~EmuWindow_SDL2_VK() override; std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; }; diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index e960b5413..3a76c785f 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -185,11 +185,11 @@ int main(int argc, char** argv) { std::unique_ptr<EmuWindow_SDL2> emu_window; switch (Settings::values.renderer_backend.GetValue()) { case Settings::RendererBackend::OpenGL: - emu_window = std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, &input_subsystem); + emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, fullscreen); break; case Settings::RendererBackend::Vulkan: #ifdef HAS_VULKAN - emu_window = std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen, &input_subsystem); + emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem); break; #else LOG_CRITICAL(Frontend, "Vulkan backend has not been compiled!"); @@ -240,14 +240,11 @@ int main(int argc, char** argv) { system.CurrentProcess()->GetTitleID(), false, [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); - std::thread render_thread([&emu_window] { emu_window->Present(); }); system.Run(); while (emu_window->IsOpen()) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); } system.Pause(); - render_thread.join(); - system.Shutdown(); detached_tasks.WaitForAllTasks(); |