From 427ce522a22fde6d9ea5ec46e3749195281cdc84 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 12 Jan 2024 20:41:13 +0100 Subject: [PATCH] opengl/glshader: print the shader source if compilation fails The shader log is almost entirely useless without the source CCBUG: 479279 --- src/opengl/glshader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/opengl/glshader.cpp b/src/opengl/glshader.cpp index 834e015142..d76ff54dc3 100644 --- a/src/opengl/glshader.cpp +++ b/src/opengl/glshader.cpp @@ -133,6 +133,11 @@ bool GLShader::compile(GLuint program, GLenum shaderType, const QByteArray &sour qCCritical(KWIN_OPENGL) << "Failed to compile" << typeName << "shader:" << "\n" << log; + size_t line = 0; + const auto split = source.split('\n'); + for (const auto &l : split) { + qCCritical(KWIN_OPENGL).nospace() << "line " << line++ << ":" << l; + } } else if (length > 0) { qCDebug(KWIN_OPENGL) << "Shader compile log:" << log; }