Support multiview in ESSL 1.00 shaders
Support is added according to the proposal for WEBGL_multiview. When
the multiview extension is enabled in an ESSL 1.00 shader, num_views
can be specified using a layout qualifier. To support this, enabling
the multiview extension makes "layout" a keyword rather than an
identifier in ESSL 1.00.
The type of gl_ViewID_OVR is also different in case of ESSL 1.00: it
has to be a signed integer, since unsigned integers are not supported
in ESSL 1.00.
Some existing tests for multiview shaders are extended in this patch.
The changes make sure that vertex shader "in" qualifier is still
allowed in ESSL 3.00 multiview shaders, since this patch adds code to
disallow it in ESSL 1.00 multiview shaders.
BUG=angleproject:1669
TEST=angle_unittests
Change-Id: I65dbbbebabdb24cf0bb647d40aa80cebf713c4f7
Reviewed-on: https://chromium-review.googlesource.com/506088
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 8ca734f..d849e19 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1085,6 +1085,13 @@
checkYuvIsNotSpecified(location, layoutQualifier.yuv);
}
+ // If multiview extension is enabled, "in" qualifier is allowed in the vertex shader in previous
+ // parsing steps. So it needs to be checked here.
+ if (isMultiviewExtensionEnabled() && mShaderVersion < 300 && qualifier == EvqVertexIn)
+ {
+ error(location, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
+ }
+
bool canHaveLocation = qualifier == EvqVertexIn || qualifier == EvqFragmentOut;
if (mShaderVersion >= 310 && qualifier == EvqUniform)
{
@@ -2353,9 +2360,7 @@
mComputeShaderLocalSizeDeclared = true;
}
- else if (mMultiviewAvailable &&
- (isExtensionEnabled("GL_OVR_multiview") || isExtensionEnabled("GL_OVR_multiview2")) &&
- typeQualifier.qualifier == EvqVertexIn)
+ else if (isMultiviewExtensionEnabled() && typeQualifier.qualifier == EvqVertexIn)
{
// This error is only specified in WebGL, but tightens unspecified behavior in the native
// specification.
@@ -3414,8 +3419,7 @@
parseLocalSize(qualifierType, qualifierTypeLine, intValue, intValueLine, intValueString, 2u,
&qualifier.localSize);
}
- else if (qualifierType == "num_views" && mMultiviewAvailable &&
- (isExtensionEnabled("GL_OVR_multiview") || isExtensionEnabled("GL_OVR_multiview2")) &&
+ else if (qualifierType == "num_views" && isMultiviewExtensionEnabled() &&
mShaderType == GL_VERTEX_SHADER)
{
parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews);