ES31: Implement GL_OES_geometry_shader built-ins in GLSL compiler

This patch intends to implement all built-in constants, variables and
functions defined in OpenGL ES 3.1 extension GL_OES_geometry_shader
in ANGLE GLSL compiler.

1. Add all built-in constants defined in GL_OES_geometry_shader.
2. Add built-in functions EmitVertex() and EndPrimitive() required
   in Geometry Shader.
3. Add built-in variables gl_PrimitiveIDIn and gl_InvocationID to
   Geometry Shader.
4. Add built-in variables gl_PrimitiveID and gl_Layer to both
   Geometry Shader and Fragment Shader when GL_OES_geometry_shader
   is enabled.

BUG=angleproject:1941
TEST=angle_unittests

Change-Id: I92821553ed0efee2ccb77fead6e065e7799819d0
Reviewed-on: https://chromium-review.googlesource.com/627670
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index f9a5bb5..75e5490 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -236,10 +236,18 @@
 
     resources->MaxUniformBufferBindings = 32;
 
-    // TODO(jiawei.shao@intel.com): add complete geometry shader constants.
-    resources->MaxGeometryUniformComponents = 1024;
-    resources->MaxGeometryOutputVertices    = 256;
-    resources->MaxGeometryShaderInvocations = 32;
+    resources->MaxGeometryUniformComponents     = 1024;
+    resources->MaxGeometryUniformBlocks         = 12;
+    resources->MaxGeometryInputComponents       = 64;
+    resources->MaxGeometryOutputComponents      = 64;
+    resources->MaxGeometryOutputVertices        = 256;
+    resources->MaxGeometryTotalOutputComponents = 1024;
+    resources->MaxGeometryTextureImageUnits     = 16;
+    resources->MaxGeometryAtomicCounterBuffers  = 0;
+    resources->MaxGeometryAtomicCounters        = 0;
+    resources->MaxGeometryShaderStorageBlocks   = 0;
+    resources->MaxGeometryShaderInvocations     = 32;
+    resources->MaxGeometryImageUniforms         = 0;
 }
 
 //
@@ -365,7 +373,7 @@
     return GetShaderVariables<Uniform>(handle);
 }
 
-const std::vector<sh::Varying> *GetInputVaryings(const ShHandle handle)
+const std::vector<Varying> *GetInputVaryings(const ShHandle handle)
 {
     TCompiler *compiler = GetCompilerFromHandle(handle);
     if (compiler == nullptr)
@@ -375,7 +383,7 @@
     return &compiler->getInputVaryings();
 }
 
-const std::vector<sh::Varying> *GetOutputVaryings(const ShHandle handle)
+const std::vector<Varying> *GetOutputVaryings(const ShHandle handle)
 {
     TCompiler *compiler = GetCompilerFromHandle(handle);
     if (compiler == nullptr)