summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-06-07 21:12:17 -0700
committerGravatar GitHub2021-06-07 21:12:17 -0700
commit3b5673daca37ab8628f0ea8d90902209c812fbcc (patch)
tree6ee7cce502ecc5ab5854cf5b67ea0c9e28c0899e /src
parentMerge pull request #6410 from lat9nq/avoid-oob (diff)
parentAvoid -Wshadow warning (diff)
downloadyuzu-3b5673daca37ab8628f0ea8d90902209c812fbcc.tar.gz
yuzu-3b5673daca37ab8628f0ea8d90902209c812fbcc.tar.xz
yuzu-3b5673daca37ab8628f0ea8d90902209c812fbcc.zip
Merge pull request #6412 from clementgallet/yuzu-cmd-window-gl
yuzu-cmd: Fix OpenGL rendering
Diffstat (limited to 'src')
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp15
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h3
2 files changed, 6 insertions, 12 deletions
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..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,17 +32,17 @@
32 32
33class SDLGLContext : public Core::Frontend::GraphicsContext { 33class SDLGLContext : public Core::Frontend::GraphicsContext {
34public: 34public:
35 explicit SDLGLContext() { 35 explicit SDLGLContext(SDL_Window* window_) : window{window_} {
36 // create a hidden window to make the shared context against
37 window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
38 SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
39 context = SDL_GL_CreateContext(window); 36 context = SDL_GL_CreateContext(window);
40 } 37 }
41 38
42 ~SDLGLContext() { 39 ~SDLGLContext() {
43 DoneCurrent(); 40 DoneCurrent();
44 SDL_GL_DeleteContext(context); 41 SDL_GL_DeleteContext(context);
45 SDL_DestroyWindow(window); 42 }
43
44 void SwapBuffers() override {
45 SDL_GL_SwapWindow(window);
46 } 46 }
47 47
48 void MakeCurrent() override { 48 void MakeCurrent() override {
@@ -114,9 +114,6 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste
114 exit(1); 114 exit(1);
115 } 115 }
116 116
117 dummy_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
118 SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
119
120 SetWindowIcon(); 117 SetWindowIcon();
121 118
122 if (fullscreen) { 119 if (fullscreen) {
@@ -159,5 +156,5 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() {
159} 156}
160 157
161std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const { 158std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const {
162 return std::make_unique<SDLGLContext>(); 159 return std::make_unique<SDLGLContext>(render_window);
163} 160}
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:
20 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override; 20 std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
21 21
22private: 22private:
23 /// Fake hidden window for the core context
24 SDL_Window* dummy_window{};
25
26 /// Whether the GPU and driver supports the OpenGL extension required 23 /// Whether the GPU and driver supports the OpenGL extension required
27 bool SupportsRequiredGLExtensions(); 24 bool SupportsRequiredGLExtensions();
28 25