From 0d49ebdf30ed8a4f5d88dae71ef3042e89100303 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 11 Dec 2014 20:00:28 +0000 Subject: GLSL #version directive does not have to be at start of line The #version directive detector of QOpenGLShaderProgram is using an incorrect regular expression to detect the #version directive in the preprocessed shader source code. It is allowed to have whitespace before the #version. Task-number: QTBUG-43240 Change-Id: If60670f49cb40148e5e7fbe6da6c798e8f636c3d Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglshaderprogram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/opengl/qopenglshaderprogram.cpp') diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index d64847510b..7d165aed48 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -481,7 +481,7 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source int splitPosition = 0; int linePosition = 1; - static const QRegularExpression pattern(QStringLiteral("^#\\s*version.*(\\n)?"), + static const QRegularExpression pattern(QStringLiteral("^\\s*#\\s*version.*(\\n)?"), QRegularExpression::MultilineOption | QRegularExpression::OptimizeOnFirstUsageOption); QRegularExpressionMatch match = pattern.match(working); -- cgit v1.2.1