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/Initialize.cpp b/src/compiler/translator/Initialize.cpp
index edc50b8..7c4aa0d 100644
--- a/src/compiler/translator/Initialize.cpp
+++ b/src/compiler/translator/Initialize.cpp
@@ -791,9 +791,15 @@
if (resources.OVR_multiview && type != GL_COMPUTE_SHADER)
{
- symbolTable.insert(COMMON_BUILTINS, "GL_OVR_multiview",
+ symbolTable.insert(ESSL3_BUILTINS, "GL_OVR_multiview",
new TVariable(NewPoolTString("gl_ViewID_OVR"),
TType(EbtUInt, EbpHigh, EvqViewIDOVR, 1)));
+
+ // ESSL 1.00 doesn't have unsigned integers, so gl_ViewID_OVR is a signed integer in ESSL
+ // 1.00. This is specified in the WEBGL_multiview spec.
+ symbolTable.insert(ESSL1_BUILTINS, "GL_OVR_multiview",
+ new TVariable(NewPoolTString("gl_ViewID_OVR"),
+ TType(EbtInt, EbpHigh, EvqViewIDOVR, 1)));
}
switch (type)