diff options
| author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2020-04-02 01:38:25 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-02 01:38:25 -0300 |
| commit | 825a6e2615f86742b2e5182af1329da4a2bae413 (patch) | |
| tree | 0b5d26f82b65067f0562b14a65b0d34aba688e01 /src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | |
| parent | baf91c920c7df131c9099721bad960556e74d86d (diff) | |
| parent | f1da3ec584e5956c8090ac9a958447e4f5e78da2 (diff) | |
Merge pull request #3552 from jroweboy/single-context
Refactor Context management (Fixes renderdoc on opengl issues)
Diffstat (limited to 'src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp')
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 18 |
1 files changed, 9 insertions, 9 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 c0d373477..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() { @@ -148,14 +156,6 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() { SDL_GL_DeleteContext(window_context); } -void EmuWindow_SDL2_GL::MakeCurrent() { - core_context->MakeCurrent(); -} - -void EmuWindow_SDL2_GL::DoneCurrent() { - core_context->DoneCurrent(); -} - void EmuWindow_SDL2_GL::RetrieveVulkanHandlers(void* get_instance_proc_addr, void* instance, void* surface) const { // Should not have been called from OpenGL |
