Validate uniform binding at link time

GLSL ES Spec 3.10.4, section 4.4.5 has the rules for linking uniforms
with binding layout qualifiers. If a binding layout qualifier for a
uniform variable is specified in both vertex and fragment shaders, the
qualifiers must match.

BUG=angleproject:1893
TEST=dEQP-GLES31.functional.layout_binding.*binding_contradictory*

Change-Id: I0ae6a1a8967df818be8136510c22daee848b9da7
Reviewed-on: https://chromium-review.googlesource.com/447557
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp
index bc1fab3..a6c885d 100644
--- a/src/compiler/translator/ShaderVars.cpp
+++ b/src/compiler/translator/ShaderVars.cpp
@@ -181,7 +181,7 @@
     return true;
 }
 
-Uniform::Uniform()
+Uniform::Uniform() : binding(-1)
 {
 }
 
@@ -189,23 +189,28 @@
 {
 }
 
-Uniform::Uniform(const Uniform &other) : ShaderVariable(other)
+Uniform::Uniform(const Uniform &other) : ShaderVariable(other), binding(other.binding)
 {
 }
 
 Uniform &Uniform::operator=(const Uniform &other)
 {
     ShaderVariable::operator=(other);
+    binding                 = other.binding;
     return *this;
 }
 
 bool Uniform::operator==(const Uniform &other) const
 {
-    return ShaderVariable::operator==(other);
+    return ShaderVariable::operator==(other) && binding == other.binding;
 }
 
 bool Uniform::isSameUniformAtLinkTime(const Uniform &other) const
 {
+    if (binding != -1 && other.binding != -1 && binding != other.binding)
+    {
+        return false;
+    }
     return ShaderVariable::isSameVariableAtLinkTime(other, true);
 }