Split varyings into input and output varyings in compiler

This patch intends to split all vector<Varying> into two vectors
to store input and output varyings separately in the compiler.

This patch is a base of implementing the built-ins, inputs and
outputs of a geometry shader to ANGLE GLSL compiler. Unlike the
vertex shaders (their outputs are varyings) and fragment shaders
(their inputs are varyings), the inputs and outputs of geometry
shaders are all varyings, so we need two vector<Varying> to store
them correctly.

BUG=angleproject:1941

Change-Id: I9e8cc16045d5e29e9a80a09dc31b33a7ae39b345
Reviewed-on: https://chromium-review.googlesource.com/593347
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index cf0483d..d3c858b 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -473,9 +473,9 @@
         if (success && shouldCollectVariables(compileOptions))
         {
             ASSERT(!variablesCollected);
-            CollectVariables(root, &attributes, &outputVariables, &uniforms, &varyings,
-                             &interfaceBlocks, hashFunction, &symbolTable, shaderVersion,
-                             extensionBehavior);
+            CollectVariables(root, &attributes, &outputVariables, &uniforms, &inputVaryings,
+                             &outputVaryings, &interfaceBlocks, hashFunction, &symbolTable,
+                             shaderVersion, extensionBehavior);
             variablesCollected = true;
             if (compileOptions & SH_USE_UNUSED_STANDARD_SHARED_BLOCKS)
             {
@@ -760,7 +760,8 @@
     attributes.clear();
     outputVariables.clear();
     uniforms.clear();
-    varyings.clear();
+    inputVaryings.clear();
+    outputVaryings.clear();
     interfaceBlocks.clear();
     variablesCollected = false;
     mGLPositionInitialized = false;
@@ -999,7 +1000,7 @@
     InitVariableList list;
     if (shaderType == GL_VERTEX_SHADER)
     {
-        for (auto var : varyings)
+        for (auto var : outputVaryings)
         {
             list.push_back(var);
             if (var.name == "gl_Position")
@@ -1063,9 +1064,16 @@
 bool TCompiler::isVaryingDefined(const char *varyingName)
 {
     ASSERT(variablesCollected);
-    for (size_t ii = 0; ii < varyings.size(); ++ii)
+    for (size_t ii = 0; ii < inputVaryings.size(); ++ii)
     {
-        if (varyings[ii].name == varyingName)
+        if (inputVaryings[ii].name == varyingName)
+        {
+            return true;
+        }
+    }
+    for (size_t ii = 0; ii < outputVaryings.size(); ++ii)
+    {
+        if (outputVaryings[ii].name == varyingName)
         {
             return true;
         }