diff --git a/third_party/duckstation/duckstation_scoped_guard.h b/third_party/duckstation/duckstation_scoped_guard.h index 89f35d92..c9e57ddd 100644 --- a/third_party/duckstation/duckstation_scoped_guard.h +++ b/third_party/duckstation/duckstation_scoped_guard.h @@ -19,6 +19,14 @@ public: /// Prevents the function from being invoked when we go out of scope. ALWAYS_INLINE void Cancel() { m_func.reset(); } + /// Runs the destructor function now instead of when we go out of scope. + ALWAYS_INLINE void Run() { + if (!m_func.has_value()) return; + + m_func.value()(); + m_func.reset(); + } + /// Explicitly fires the function. ALWAYS_INLINE void Invoke() { diff --git a/third_party/duckstation/gl/context_wgl.cpp b/third_party/duckstation/gl/context_wgl.cpp index b2e0d2e5..3837656b 100644 --- a/third_party/duckstation/gl/context_wgl.cpp +++ b/third_party/duckstation/gl/context_wgl.cpp @@ -19,6 +19,17 @@ static void* GetProcAddressCallback(const char* name) } namespace GL { +static bool ReloadWGL(HDC dc) +{ + if (!gladLoadWGL(dc)) + { + Log_ErrorPrint("Loading GLAD WGL functions failed"); + return false; + } + + return true; +} + ContextWGL::ContextWGL(const WindowInfo& wi) : Context(wi) {} ContextWGL::~ContextWGL()