ShaderVars: add isSameInterfaceBlockFieldAtLinkTime

This will be used by Chromium to check for interface blocks mismatches.

BUG=621031

Change-Id: Ia6cc19e5d7b2a5c33af558d65b87885a6b72cea3
Reviewed-on: https://chromium-review.googlesource.com/359607
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp
index 8f931b9..846815e 100644
--- a/src/compiler/translator/ShaderVars.cpp
+++ b/src/compiler/translator/ShaderVars.cpp
@@ -355,7 +355,7 @@
 bool Varying::isSameVaryingAtLinkTime(const Varying &other, int shaderVersion) const
 {
     return (ShaderVariable::isSameVariableAtLinkTime(other, false) &&
-            interpolation == other.interpolation &&
+            InterpolationTypesMatch(interpolation, other.interpolation) &&
             (shaderVersion >= 300 || isInvariant == other.isInvariant));
 }
 
@@ -398,4 +398,24 @@
     return instanceName.empty() ? "" : name;
 }
 
+bool InterfaceBlock::isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const
+{
+    if (name != other.name || mappedName != other.mappedName || arraySize != other.arraySize ||
+        layout != other.layout || isRowMajorLayout != other.isRowMajorLayout ||
+        fields.size() != other.fields.size())
+    {
+        return false;
+    }
+
+    for (size_t fieldIndex = 0; fieldIndex < fields.size(); ++fieldIndex)
+    {
+        if (!fields[fieldIndex].isSameInterfaceBlockFieldAtLinkTime(other.fields[fieldIndex]))
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
 }  // namespace sh