summaryrefslogtreecommitdiffstats
path: root/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
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_tester/emu_window/emu_window_sdl2_hide.cpp
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_tester/emu_window/emu_window_sdl2_hide.cpp')
-rw-r--r--src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
index a1bdb1a12..a837430cc 100644
--- a/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
+++ b/src/yuzu_tester/emu_window/emu_window_sdl2_hide.cpp
@@ -102,8 +102,6 @@ EmuWindow_SDL2_Hide::EmuWindow_SDL2_Hide() {
LOG_INFO(Frontend, "yuzu-tester Version: {} | {}-{}", Common::g_build_fullname,
Common::g_scm_branch, Common::g_scm_desc);
Settings::LogSettings();
-
- DoneCurrent();
}
EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() {
@@ -114,14 +112,6 @@ EmuWindow_SDL2_Hide::~EmuWindow_SDL2_Hide() {
void EmuWindow_SDL2_Hide::PollEvents() {}
-void EmuWindow_SDL2_Hide::MakeCurrent() {
- SDL_GL_MakeCurrent(render_window, gl_context);
-}
-
-void EmuWindow_SDL2_Hide::DoneCurrent() {
- SDL_GL_MakeCurrent(render_window, nullptr);
-}
-
bool EmuWindow_SDL2_Hide::IsShown() const {
return false;
}
@@ -129,3 +119,35 @@ bool EmuWindow_SDL2_Hide::IsShown() const {
void EmuWindow_SDL2_Hide::RetrieveVulkanHandlers(void*, void*, void*) const {
UNREACHABLE();
}
+
+class SDLGLContext : public Core::Frontend::GraphicsContext {
+public:
+ explicit SDLGLContext() {
+ // create a hidden window to make the shared context against
+ window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
+ SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
+ context = SDL_GL_CreateContext(window);
+ }
+
+ ~SDLGLContext() {
+ DoneCurrent();
+ SDL_GL_DeleteContext(context);
+ SDL_DestroyWindow(window);
+ }
+
+ void MakeCurrent() override {
+ SDL_GL_MakeCurrent(window, context);
+ }
+
+ void DoneCurrent() override {
+ SDL_GL_MakeCurrent(window, nullptr);
+ }
+
+private:
+ SDL_Window* window;
+ SDL_GLContext context;
+};
+
+std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_Hide::CreateSharedContext() const {
+ return std::make_unique<SDLGLContext>();
+}