Add support for ES31 context creation
The dEQP test for context creation passes.
SH_WEBGL3_SPEC has been added, but it should be considered whether we
should keep it, remove it or rename it. It was added so that there is
a webgl mapping to es 310 shaders. Check Compiler.cpp. The bison file
has been modified so that some tokens from es3 can be also used in
es31 as well.
A separate macro ES3_1_ONLY is added so that some tokens are limited
only for es 310 shaders.
BUG=angleproject:1442
TEST=angle_unittests
Change-Id: I2e5ca227c96046c30dc796ab934f3fda9c533eba
Reviewed-on: https://chromium-review.googlesource.com/360300
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Compiler.cpp b/src/libANGLE/Compiler.cpp
index 33ce14b..37346a0 100644
--- a/src/libANGLE/Compiler.cpp
+++ b/src/libANGLE/Compiler.cpp
@@ -23,17 +23,33 @@
// ShFinalize.
size_t activeCompilerHandles = 0;
+ShShaderSpec SelectShaderSpec(GLint majorVersion, GLint minorVersion)
+{
+ if (majorVersion >= 3)
+ {
+ if (minorVersion == 1)
+ {
+ return SH_GLES3_1_SPEC;
+ }
+ else
+ {
+ return SH_GLES3_SPEC;
+ }
+ }
+ return SH_GLES2_SPEC;
+}
+
} // anonymous namespace
Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
: mImplementation(implFactory->createCompiler()),
- mSpec(state.getClientVersion() > 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
+ mSpec(SelectShaderSpec(state.getClientMajorVersion(), state.getClientMinorVersion())),
mOutputType(mImplementation->getTranslatorOutputType()),
mResources(),
mFragmentCompiler(nullptr),
mVertexCompiler(nullptr)
{
- ASSERT(state.getClientVersion() == 2 || state.getClientVersion() == 3);
+ ASSERT(state.getClientMajorVersion() == 2 || state.getClientMajorVersion() == 3);
const gl::Caps &caps = state.getCaps();
const gl::Extensions &extensions = state.getExtensions();