opengl/glshader: print the shader source if compilation fails

The shader log is almost entirely useless without the source

CCBUG: 479279
This commit is contained in:
Xaver Hugl 2024-01-12 20:41:13 +01:00
parent d4a3d6689e
commit 427ce522a2

View file

@ -133,6 +133,11 @@ bool GLShader::compile(GLuint program, GLenum shaderType, const QByteArray &sour
qCCritical(KWIN_OPENGL) << "Failed to compile" << typeName << "shader:" qCCritical(KWIN_OPENGL) << "Failed to compile" << typeName << "shader:"
<< "\n" << "\n"
<< log; << 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) { } else if (length > 0) {
qCDebug(KWIN_OPENGL) << "Shader compile log:" << log; qCDebug(KWIN_OPENGL) << "Shader compile log:" << log;
} }