From 9a852475c5b9b87890f523614acfd180b2c8f064 Mon Sep 17 00:00:00 2001 From: offtkp Date: Fri, 9 Aug 2024 01:41:18 +0300 Subject: [PATCH] Fix a couple things --- src/panda_qt/main_window.cpp | 16 ++++++++-------- third_party/duckstation/gl/context_egl_x11.cpp | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/panda_qt/main_window.cpp b/src/panda_qt/main_window.cpp index e0e76d05..24303d79 100644 --- a/src/panda_qt/main_window.cpp +++ b/src/panda_qt/main_window.cpp @@ -606,29 +606,29 @@ void MainWindow::pollControllers() { namespace AsyncCompiler { void* createContext(void* mainContext) { - GL::Context* glContext = static_cast(mainContext); + GL::Context* glContext = (GL::Context*)mainContext; // Unlike the SDL function, this doesn't make it current so we don't // need to call MakeCurrent on the mainContext WindowInfo wi = glContext->GetWindowInfo(); wi.type = WindowInfo::Type::Surfaceless; - std::unique_ptr* newContext = new std::unique_ptr(glContext->CreateSharedContext(wi)); + std::unique_ptr iLoveBeingForcedToUseRAII = glContext->CreateSharedContext(wi); - if (newContext->get() == nullptr) { + if (!iLoveBeingForcedToUseRAII) { Helpers::panic("Failed to create shared GL context"); } - return newContext; + return iLoveBeingForcedToUseRAII.release(); } - void makeCurrent(void* mainContext, void* context) { - std::unique_ptr* glContext = static_cast*>(context); - (*glContext)->MakeCurrent(); + void makeCurrent(void* unused, void* context) { + GL::Context* glContext = (GL::Context*)context; + glContext->MakeCurrent(); } void destroyContext(void* context) { - std::unique_ptr* glContext = static_cast*>(context); + GL::Context* glContext = (GL::Context*)context; delete glContext; } } // namespace AsyncCompiler \ No newline at end of file diff --git a/third_party/duckstation/gl/context_egl_x11.cpp b/third_party/duckstation/gl/context_egl_x11.cpp index 6db6c10b..bb5e40f9 100644 --- a/third_party/duckstation/gl/context_egl_x11.cpp +++ b/third_party/duckstation/gl/context_egl_x11.cpp @@ -20,6 +20,7 @@ std::unique_ptr ContextEGLX11::CreateSharedContext(const WindowInfo& wi { std::unique_ptr context = std::make_unique(wi); context->m_display = m_display; + context->m_supports_surfaceless = m_supports_surfaceless; if (!context->CreateContextAndSurface(m_version, m_context, false)) return nullptr;