ES31: Fix wrong method of computing combined interface blocks

This patch fixes a bug in the method of validating the number of
combined interface blocks in currenct ANGLE implementation.

When a resource (uniform block, shader storage block, image, atomic
counter buffer, atomic counter) is used by multiple shader stages,
each such use counts separately against the combined resource limit.

This patch also fixes an unexpected link error in a related test by
skipping the test when the number of ssbos exceeds the resouorce
limit.

BUG=angleproject:1951
TEST=angle_end2end_tests

Change-Id: I0de439a412148e0d5ebef3c27d20e0cbd536175a
Reviewed-on: https://chromium-review.googlesource.com/945143
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiajia Qin <jiajia.qin@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index b1757e4..980aa4b 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -2660,13 +2660,17 @@
                 return false;
             }
         }
-        else
+
+        // [OpenGL ES 3.1] Chapter 7.6.2 Page 105:
+        // If a uniform block is used by multiple shader stages, each such use counts separately
+        // against this combined limit.
+        // [OpenGL ES 3.1] Chapter 7.8 Page 111:
+        // If a shader storage block in a program is referenced by multiple shaders, each such
+        // reference counts separately against this combined limit.
+        if (fragmentInterfaceBlock.staticUse ||
+            fragmentInterfaceBlock.layout != sh::BLOCKLAYOUT_PACKED)
         {
-            if (fragmentInterfaceBlock.staticUse ||
-                fragmentInterfaceBlock.layout != sh::BLOCKLAYOUT_PACKED)
-            {
-                blockCount += std::max(fragmentInterfaceBlock.arraySize, 1u);
-            }
+            blockCount += std::max(fragmentInterfaceBlock.arraySize, 1u);
         }
     }