From 63eb6b3bda71e7e5a1043f585ae39e878cb56b55 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Fri, 6 Feb 2026 22:02:20 +0100 Subject: opengl: add debug:gl_debugging (#13183) add debug:gl_debugging so we can disable gl debugging entirerly, both glGetError and enabling EGL_KHR_debug has its cost, we still have EXT_create_context_robustness and glGetGraphicsResetStatus that should catch context loss, and is generally cheap to call it only checks a flag set. glGetError might cause a implicit flush to get any pending calls sent to the gpu. however to get EGL_KHR_debug back enabled we now require a restart of the compositor after changing debug:gl_debugging --- src/render/OpenGL.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/render/OpenGL.cpp') diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index e3690ecd..3e0c4f26 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -304,7 +304,8 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() : m_drmFD(g_pCompositor->m_drmRenderNode.fd > loadGLProc(&m_proc.eglQueryDisplayAttribEXT, "eglQueryDisplayAttribEXT"); } - if (EGLEXTENSIONS.contains("EGL_KHR_debug")) { + static const auto GLDEBUG = CConfigValue("debug:gl_debugging"); + if (EGLEXTENSIONS.contains("EGL_KHR_debug") && *GLDEBUG) { loadGLProc(&m_proc.eglDebugMessageControlKHR, "eglDebugMessageControlKHR"); static const EGLAttrib debugAttrs[] = { EGL_DEBUG_MSG_CRITICAL_KHR, EGL_TRUE, EGL_DEBUG_MSG_ERROR_KHR, EGL_TRUE, EGL_DEBUG_MSG_WARN_KHR, EGL_TRUE, EGL_DEBUG_MSG_INFO_KHR, EGL_TRUE, EGL_NONE, @@ -838,11 +839,15 @@ void CHyprOpenGLImpl::end() { if UNLIKELY (m_renderData.pCurrentMonData->offMainFB.isAllocated()) m_renderData.pCurrentMonData->offMainFB.release(); - // check for gl errors - const GLenum ERR = glGetError(); + static const auto GLDEBUG = CConfigValue("debug:gl_debugging"); - if UNLIKELY (ERR == GL_CONTEXT_LOST) /* We don't have infra to recover from this */ - RASSERT(false, "glGetError at Opengl::end() returned GL_CONTEXT_LOST. Cannot continue until proper GPU reset handling is implemented."); + if (*GLDEBUG) { + // check for gl errors + const GLenum ERR = glGetError(); + + if UNLIKELY (ERR == GL_CONTEXT_LOST) /* We don't have infra to recover from this */ + RASSERT(false, "glGetError at Opengl::end() returned GL_CONTEXT_LOST. Cannot continue until proper GPU reset handling is implemented."); + } } void CHyprOpenGLImpl::setDamage(const CRegion& damage_, std::optional finalDamage) { -- cgit v1.2.3