summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd/emu_window
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-04-02 06:38:25 +0200
committerGitHub <noreply@github.com>2020-04-02 06:38:25 +0200
commit825a6e2615f86742b2e5182af1329da4a2bae413 (patch)
tree0b5d26f82b65067f0562b14a65b0d34aba688e01 /src/yuzu_cmd/emu_window
parentMerge pull request #3591 from ReinUsesLisp/vk-wrapper-part2 (diff)
parentFrontend: Don't call DoneCurrent if the context isnt already current (diff)
downloadyuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar.gz
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar.bz2
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar.lz
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar.xz
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.tar.zst
yuzu-825a6e2615f86742b2e5182af1329da4a2bae413.zip
Diffstat (limited to 'src/yuzu_cmd/emu_window')
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp18
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h2
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp8
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h2
4 files changed, 9 insertions, 21 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
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 b80669ff0..e092021d7 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.h
@@ -13,8 +13,6 @@ public:
explicit EmuWindow_SDL2_GL(Core::System& system, bool fullscreen);
~EmuWindow_SDL2_GL();
- void MakeCurrent() override;
- void DoneCurrent() override;
void Present() override;
/// Ignored in OpenGL
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
index abcc58165..46d053f04 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
@@ -111,14 +111,6 @@ EmuWindow_SDL2_VK::~EmuWindow_SDL2_VK() {
vkDestroyInstance(vk_instance, nullptr);
}
-void EmuWindow_SDL2_VK::MakeCurrent() {
- // Unused on Vulkan
-}
-
-void EmuWindow_SDL2_VK::DoneCurrent() {
- // Unused on Vulkan
-}
-
void EmuWindow_SDL2_VK::RetrieveVulkanHandlers(void* get_instance_proc_addr, void* instance,
void* surface) const {
const auto instance_proc_addr = vkGetInstanceProcAddr;
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
index 1eb8c0868..3dd1f3f61 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.h
@@ -13,8 +13,6 @@ public:
explicit EmuWindow_SDL2_VK(Core::System& system, bool fullscreen);
~EmuWindow_SDL2_VK();
- void MakeCurrent() override;
- void DoneCurrent() override;
void Present() override;
void RetrieveVulkanHandlers(void* get_instance_proc_addr, void* instance,
void* surface) const override;