From b70a8482bda5cea6eed44d5558cdf2b4cc3efddb Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 10 Nov 2024 17:02:14 +1000 Subject: [PATCH] OpenGLDevice: More verbose logging of surface creation failure --- src/util/opengl_context_egl.cpp | 13 ++++++++++++- src/util/opengl_context_egl_wayland.cpp | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/util/opengl_context_egl.cpp b/src/util/opengl_context_egl.cpp index e0caa726e..4ed96428d 100644 --- a/src/util/opengl_context_egl.cpp +++ b/src/util/opengl_context_egl.cpp @@ -123,10 +123,21 @@ bool OpenGLContextEGL::Initialize(WindowInfo& wi, SurfaceHandle* surface, std::s if (!GLAD_EGL_KHR_surfaceless_context) WARNING_LOG("EGL implementation does not support surfaceless contexts, emulating with pbuffers"); + Error context_error; for (const Version& cv : versions_to_try) { - if (CreateContextAndSurface(wi, surface, cv, nullptr, true, error)) + if (CreateContextAndSurface(wi, surface, cv, nullptr, true, &context_error)) + { return true; + } + else + { + WARNING_LOG("Failed to create {}.{} ({}) context: {}", cv.major_version, cv.minor_version, + cv.profile == OpenGLContext::Profile::ES ? + "ES" : + (cv.profile == OpenGLContext::Profile::Core ? "Core" : "None"), + context_error.GetDescription()); + } } Error::SetStringView(error, "Failed to create any context versions"); diff --git a/src/util/opengl_context_egl_wayland.cpp b/src/util/opengl_context_egl_wayland.cpp index 7c6554ccb..0d92dad8d 100644 --- a/src/util/opengl_context_egl_wayland.cpp +++ b/src/util/opengl_context_egl_wayland.cpp @@ -89,12 +89,12 @@ void OpenGLContextEGLWayland::ResizeSurface(WindowInfo& wi, SurfaceHandle handle void OpenGLContextEGLWayland::DestroyPlatformSurface(EGLSurface surface) { + OpenGLContextEGL::DestroyPlatformSurface(surface); + const auto it = m_wl_window_map.find((EGLSurface)surface); AssertMsg(it != m_wl_window_map.end(), "Missing WL window"); m_wl_egl_window_destroy(it->second); m_wl_window_map.erase(it); - - OpenGLContextEGL::DestroyPlatformSurface(surface); } std::unique_ptr OpenGLContextEGLWayland::Create(WindowInfo& wi, SurfaceHandle* surface,