Guarantee that symbol nodes get unique ids

The code is refactored so that symbol nodes can only be initialized
with an unique id object. This prevents accidentally forgetting to
create an id for a symbol node.

This opens up possibilities for future optimization: For example the
names and types of symbols could be stored in a central location
inside the SymbolTable, and TIntermSymbol nodes would only need to
store the symbol id. The symbol id could be used to look up the name
and type of the node.

BUG=angleproject:1490
TEST=angle_unittests

Change-Id: Ib8c8675d31493037a5a28c7b36bb9d1113cc10f6
Reviewed-on: https://chromium-review.googlesource.com/580955
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: 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 769c93a..44bc662 100644
--- a/src/compiler/translator/Initialize.cpp
+++ b/src/compiler/translator/Initialize.cpp
@@ -964,6 +964,8 @@
             // For internal use by ANGLE - not exposed to the parser.
             symbolTable.insertVariable(GLSL_BUILTINS, "gl_ViewportIndex",
                                        TType(EbtInt, EbpHigh, EvqViewportIndex));
+            // gl_Layer exists in other shader stages in ESSL, but not in vertex shader so far.
+            symbolTable.insertVariable(GLSL_BUILTINS, "gl_Layer", TType(EbtInt, EbpHigh, EvqLayer));
             break;
         }
         case GL_COMPUTE_SHADER: