summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.cpp5
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp10
2 files changed, 13 insertions, 2 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 4e9ced8ba..eaded2640 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -141,7 +141,7 @@ public:
141 } 141 }
142 142
143 ~OpenGLSharedContext() { 143 ~OpenGLSharedContext() {
144 context->doneCurrent(); 144 DoneCurrent();
145 } 145 }
146 146
147 void SwapBuffers() override { 147 void SwapBuffers() override {
@@ -156,6 +156,9 @@ public:
156 } 156 }
157 157
158 void DoneCurrent() override { 158 void DoneCurrent() override {
159 if (!is_current) {
160 return;
161 }
159 context->doneCurrent(); 162 context->doneCurrent();
160 is_current = false; 163 is_current = false;
161 } 164 }
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 ee61179a0..3522dcf6d 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp
@@ -37,16 +37,24 @@ public:
37 } 37 }
38 38
39 void MakeCurrent() override { 39 void MakeCurrent() override {
40 SDL_GL_MakeCurrent(window, context); 40 if (is_current) {
41 return;
42 }
43 is_current = SDL_GL_MakeCurrent(window, context) == 0;
41 } 44 }
42 45
43 void DoneCurrent() override { 46 void DoneCurrent() override {
47 if (!is_current) {
48 return;
49 }
44 SDL_GL_MakeCurrent(window, nullptr); 50 SDL_GL_MakeCurrent(window, nullptr);
51 is_current = false;
45 } 52 }
46 53
47private: 54private:
48 SDL_Window* window; 55 SDL_Window* window;
49 SDL_GLContext context; 56 SDL_GLContext context;
57 bool is_current = false;
50}; 58};
51 59
52bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() { 60bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() {