summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2020-03-30 14:52:46 -0600
committerJames Rowe <jroweboy@gmail.com>2020-03-30 14:57:42 -0600
commitf1da3ec584e5956c8090ac9a958447e4f5e78da2 (patch)
treee68a313e919cfce944bf9857038502b97d4b35e2 /src
parentcf9c94d4017120b618194a720942ef4e5c8289bd (diff)
Frontend: Don't call DoneCurrent if the context isnt already current
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:
}
~OpenGLSharedContext() {
- context->doneCurrent();
+ DoneCurrent();
}
void SwapBuffers() override {
@@ -156,6 +156,9 @@ public:
}
void DoneCurrent() override {
+ if (!is_current) {
+ return;
+ }
context->doneCurrent();
is_current = false;
}
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:
}
void MakeCurrent() override {
- SDL_GL_MakeCurrent(window, context);
+ if (is_current) {
+ return;
+ }
+ is_current = SDL_GL_MakeCurrent(window, context) == 0;
}
void DoneCurrent() override {
+ if (!is_current) {
+ return;
+ }
SDL_GL_MakeCurrent(window, nullptr);
+ is_current = false;
}
private:
SDL_Window* window;
SDL_GLContext context;
+ bool is_current = false;
};
bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() {