summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2026-02-06 22:02:20 +0100
committerGitHub <noreply@github.com>2026-02-06 21:02:20 +0000
commit63eb6b3bda71e7e5a1043f585ae39e878cb56b55 (patch)
tree2966a3d36d8715cd9dc740a1fce1ce5d809536d1 /src
parent8606bc255b5cfe2ca6270fa71053c76a6ce5e837 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp6
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/macros.hpp11
-rw-r--r--src/render/OpenGL.cpp15
4 files changed, 24 insertions, 9 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 7ae948bb..0a1e37d5 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1753,6 +1753,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.data = SConfigOptionDescription::SBoolData{false},
},
SConfigOptionDescription{
+ .value = "debug:gl_debugging",
+ .description = "enable OpenGL debugging and error checking, they hurt performance.",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{false},
+ },
+ SConfigOptionDescription{
.value = "debug:disable_logs",
.description = "disable logging to a file",
.type = CONFIG_OPTION_BOOL,
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 6fab9d7e..09ec4456 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -561,6 +561,7 @@ CConfigManager::CConfigManager() {
registerConfigVar("debug:overlay", Hyprlang::INT{0});
registerConfigVar("debug:damage_blink", Hyprlang::INT{0});
registerConfigVar("debug:pass", Hyprlang::INT{0});
+ registerConfigVar("debug:gl_debugging", Hyprlang::INT{0});
registerConfigVar("debug:disable_logs", Hyprlang::INT{1});
registerConfigVar("debug:disable_time", Hyprlang::INT{1});
registerConfigVar("debug:enable_stdout_logs", Hyprlang::INT{0});
diff --git a/src/macros.hpp b/src/macros.hpp
index 1b55bacd..fc109296 100644
--- a/src/macros.hpp
+++ b/src/macros.hpp
@@ -96,10 +96,13 @@
#define GLCALL(__CALL__) \
{ \
__CALL__; \
- auto err = glGetError(); \
- if (err != GL_NO_ERROR) { \
- Log::logger->log(Log::ERR, "[GLES] Error in call at {}@{}: 0x{:x}", __LINE__, \
- ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })(), err); \
+ static const auto GLDEBUG = CConfigValue<Hyprlang::INT>("debug:gl_debugging"); \
+ if (*GLDEBUG) { \
+ auto err = glGetError(); \
+ if (err != GL_NO_ERROR) { \
+ Log::logger->log(Log::ERR, "[GLES] Error in call at {}@{}: 0x{:x}", __LINE__, \
+ ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })(), err); \
+ } \
} \
}
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<Hyprlang::INT>("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<Hyprlang::INT>("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<CRegion> finalDamage) {