From b6c3f55b932b28a7e4acdd5952a93e929b461b92 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 3 Aug 2017 17:28:47 +0200 Subject: [PATCH] GLSL 1.00 ES must be selected using "#version 100" I was mistaken before, the "es" part for that version isn't optional, it *must* be omitted. Change-Id: I9e83d2317523fb0a905e40b95a56033cf693b93b Reviewed-by: Paul Lemire --- src/gui/util/qshadergenerator.cpp | 2 +- .../auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/util/qshadergenerator.cpp b/src/gui/util/qshadergenerator.cpp index 7d16448647..31c2f74746 100644 --- a/src/gui/util/qshadergenerator.cpp +++ b/src/gui/util/qshadergenerator.cpp @@ -294,7 +294,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) : major == 3 && minor <= 2 ? 100 + 10 * (minor + 3) : major * 100 + minor * 10; - const auto profile = isGLES ? QByteArrayLiteral(" es") + const auto profile = isGLES && version > 100 ? QByteArrayLiteral(" es") : version >= 150 && format.api() == QShaderFormat::OpenGLCoreProfile ? QByteArrayLiteral(" core") : version >= 150 && format.api() == QShaderFormat::OpenGLCompatibilityProfile ? QByteArrayLiteral(" compatibility") : QByteArray(); diff --git a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp index 662373aea7..d0a0225055 100644 --- a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp +++ b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp @@ -220,7 +220,7 @@ void tst_QShaderGenerator::shouldGenerateShaderCode_data() const auto openGL32 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 2); const auto openGL4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0); - const auto versionGLES2 = QByteArrayList() << "#version 100 es" << ""; + const auto versionGLES2 = QByteArrayList() << "#version 100" << ""; const auto versionGL3 = QByteArrayList() << "#version 130" << ""; const auto versionGL32 = QByteArrayList() << "#version 150 core" << ""; const auto versionGL4 = QByteArrayList() << "#version 400 core" << ""; @@ -298,7 +298,7 @@ void tst_QShaderGenerator::shouldGenerateVersionCommands_data() QTest::addColumn("format"); QTest::addColumn("version"); - QTest::newRow("GLES2") << createFormat(QShaderFormat::OpenGLES, 2, 0) << QByteArrayLiteral("#version 100 es"); + QTest::newRow("GLES2") << createFormat(QShaderFormat::OpenGLES, 2, 0) << QByteArrayLiteral("#version 100"); QTest::newRow("GLES3") << createFormat(QShaderFormat::OpenGLES, 3, 0) << QByteArrayLiteral("#version 300 es"); QTest::newRow("GL20") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0) << QByteArrayLiteral("#version 110"); @@ -659,7 +659,7 @@ void tst_QShaderGenerator::shouldProcessLanguageQualifierAndTypeEnums_data() << " fragColor = v0;" << "}" << "").join("\n"); - const auto es2Code = (QByteArrayList() << "#version 100 es" + const auto es2Code = (QByteArrayList() << "#version 100" << "" << QStringLiteral("%1 highp %2 worldPosition;").arg(toGlsl(qualifierValue, es2)) .arg(toGlsl(typeValue))