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 <laszlo.agocs@theqtcompany.com>
bb10
Sean Harmer 2014-12-11 20:00:28 +00:00
parent a69b2c0168
commit 0d49ebdf30
1 changed files with 1 additions and 1 deletions

View File

@ -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);