ES31: Add link validations on geometry shader uniforms

This patch adds the link validations on the uniforms defined in a
geometry shader.

1. Validate if there is any link mismatch between a geometry shader
   uniform and a uniform defined in another shader in the current
   graphics pipeline.
2. Validate if the number of images, samplers or atomic counters in
   a geometry shader exceeds the related resource limit.
3. Validate if there is name contradiction between a geometry shader
   uniform and a vertex shader attribute.

BUG=angleproject:1941
TEST=dEQP-GLES31.functional.shaders.linkage.es31.geometry.uniform.*
     dEQP-GLES31.functional.geometry_shading.basic.*
     dEQP-GLES31.functional.geometry_shading.conversion.*
     dEQP-GLES31.functional.geometry_shading.emit.*
     dEQP-GLES31.functional.geometry_shading.varying.*
     dEQP-GLES31.functional.geometry_shading.instanced.geometry_*
     dEQP-GLES31.functional.geometry_shading.instanced.invocation_output_*
     dEQP-GLES31.functional.geometry_shading.instanced.draw_*

Change-Id: I365aee624a3a79658c3e4c7487a586cf9532b529
Reviewed-on: https://chromium-review.googlesource.com/939264
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index ec32a15..2b29002 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -2466,7 +2466,7 @@
         }
     }
     // TODO(jie.a.chen@intel.com): Count each atomic counter buffer to validate against
-    // gl_Max[Vertex|Fragment|Compute|Combined]AtomicCounterBuffers.
+    // gl_Max[Vertex|Fragment|Compute|Geometry|Combined]AtomicCounterBuffers.
 
     return true;
 }
@@ -3108,6 +3108,9 @@
         mState.mAttachedVertexShader->getUniforms(context);
     const std::vector<sh::Uniform> &fragmentUniforms =
         mState.mAttachedFragmentShader->getUniforms(context);
+    const std::vector<sh::Uniform> *geometryUniforms =
+        (mState.mAttachedGeometryShader) ? &mState.mAttachedGeometryShader->getUniforms(context)
+                                         : nullptr;
     const std::vector<sh::Attribute> &attributes =
         mState.mAttachedVertexShader->getActiveAttributes(context);
     for (const auto &attrib : attributes)
@@ -3128,6 +3131,17 @@
                 return false;
             }
         }
+        if (geometryUniforms)
+        {
+            for (const auto &uniform : *geometryUniforms)
+            {
+                if (uniform.name == attrib.name)
+                {
+                    infoLog << "Name conflicts between a uniform and an attribute: " << attrib.name;
+                    return false;
+                }
+            }
+        }
     }
     return true;
 }