From 9ff8504452ee6cb1eefd61918ed61d6f6362cb31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gallet?= Date: Fri, 4 Jun 2021 11:39:04 +0200 Subject: yuzu-cmd: Fix OpenGL rendering --- src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 15 ++++++--------- src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h | 3 --- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src') 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 3c49a300b..a3c513e3a 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -32,17 +32,17 @@ class SDLGLContext : public Core::Frontend::GraphicsContext { public: - explicit SDLGLContext() { - // create a hidden window to make the shared context against - window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); + explicit SDLGLContext(SDL_Window* window) : window(window) { context = SDL_GL_CreateContext(window); } ~SDLGLContext() { DoneCurrent(); SDL_GL_DeleteContext(context); - SDL_DestroyWindow(window); + } + + void SwapBuffers() override { + SDL_GL_SwapWindow(window); } void MakeCurrent() override { @@ -114,9 +114,6 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste exit(1); } - dummy_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, - SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL); - SetWindowIcon(); if (fullscreen) { @@ -159,5 +156,5 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() { } std::unique_ptr EmuWindow_SDL2_GL::CreateSharedContext() const { - return std::make_unique(); + return std::make_unique(render_window); } 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 dba5c293c..9e694d985 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h @@ -20,9 +20,6 @@ public: std::unique_ptr CreateSharedContext() const override; private: - /// Fake hidden window for the core context - SDL_Window* dummy_window{}; - /// Whether the GPU and driver supports the OpenGL extension required bool SupportsRequiredGLExtensions(); -- cgit v1.2.3 From 2e1c58b9055a9177cdefd4373dd256e98f8603fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gallet?= Date: Sat, 5 Jun 2021 18:43:10 +0200 Subject: Avoid -Wshadow warning Co-authored-by: Mai M. --- src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 a3c513e3a..837a44be7 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp @@ -32,7 +32,7 @@ class SDLGLContext : public Core::Frontend::GraphicsContext { public: - explicit SDLGLContext(SDL_Window* window) : window(window) { + explicit SDLGLContext(SDL_Window* window_) : window{window_} { context = SDL_GL_CreateContext(window); } -- cgit v1.2.3