Add an SH_GLSL_CORE_OUTPUT profile.
So we could generate shaders for Apple using core GL profile.
By switching to core profile, we still pass most WebGL conformance tests 1.0.2 on Linux, but not all, so apparently more work is needed.
However, I think it's OK to check this CL in because this output profile will be only used behind a chromium switch.
BUG=angleproject:933
TEST=webgl conformance tests
Change-Id: Iad70e1aebf82349d3fc5f4116c1d6bc4448193fd
Reviewed-on: https://chromium-review.googlesource.com/255282
Tested-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/VersionGLSL.cpp b/src/compiler/translator/VersionGLSL.cpp
index 05b111a..f6f5688 100644
--- a/src/compiler/translator/VersionGLSL.cpp
+++ b/src/compiler/translator/VersionGLSL.cpp
@@ -8,6 +8,7 @@
static const int GLSL_VERSION_110 = 110;
static const int GLSL_VERSION_120 = 120;
+static const int GLSL_VERSION_150 = 150;
// We need to scan for the following:
// 1. "invariant" keyword: This can occur in both - vertex and fragment shaders
@@ -26,12 +27,22 @@
// GLSL 1.2 relaxed the restriction on arrays, section 5.8: "Variables that
// are built-in types, entire structures or arrays... are all l-values."
//
-TVersionGLSL::TVersionGLSL(sh::GLenum type, const TPragma &pragma)
+TVersionGLSL::TVersionGLSL(sh::GLenum type,
+ const TPragma &pragma,
+ ShShaderOutput output)
{
- if (pragma.stdgl.invariantAll)
- mVersion = GLSL_VERSION_120;
+ if (output == SH_GLSL_CORE_OUTPUT)
+ {
+ mVersion = GLSL_VERSION_150;
+ }
else
- mVersion = GLSL_VERSION_110;
+ {
+ ASSERT(output == SH_GLSL_COMPATIBILITY_OUTPUT);
+ if (pragma.stdgl.invariantAll)
+ mVersion = GLSL_VERSION_120;
+ else
+ mVersion = GLSL_VERSION_110;
+ }
}
void TVersionGLSL::visitSymbol(TIntermSymbol *node)