Reland "Add workaround for unused std140 and shared uniform blocks on MacOS"

On some Mac drivers with shader version 4.1, they will
treat unused std140 and shared uniform blocks' members as inactive. However,
WebGL2.0 based on OpenGL ES3.0.4 requires all members of a named uniform block
declared with a shared or std140 layout qualifier to be considered active.
The uniform block itself is also considered active.

This workaround is to reference all members of unused std140 and shared uniform blocks
at the beginning of the vertex/fragment shader's main().

BUG=chromium:618464
TEST=UniformBufferTest.ActiveUniformBlockNumber

Change-Id: I18da4e2b61b0170068bf5ea38ce54667b0737780
Reviewed-on: https://chromium-review.googlesource.com/395648
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/util.cpp b/src/compiler/translator/util.cpp
index d6339a8..584d653 100644
--- a/src/compiler/translator/util.cpp
+++ b/src/compiler/translator/util.cpp
@@ -278,10 +278,39 @@
     }
 }
 
+TType GetInterfaceBlockType(const sh::InterfaceBlock &block)
+{
+    TType type;
+    TFieldList *fields = new TFieldList;
+    TSourceLoc loc;
+    for (const auto &field : block.fields)
+    {
+        TType *fieldType = new TType(GetShaderVariableType(field));
+        fields->push_back(new TField(fieldType, new TString(field.name.c_str()), loc));
+    }
+
+    TInterfaceBlock *interfaceBlock = new TInterfaceBlock(
+        new TString(block.name.c_str()), fields, new TString(block.instanceName.c_str()),
+        block.arraySize, TLayoutQualifier::create());
+
+    type.setBasicType(EbtInterfaceBlock);
+    type.setInterfaceBlock(interfaceBlock);
+    type.setArraySize(block.arraySize);
+    return type;
+}
+
 TType GetShaderVariableBasicType(const sh::ShaderVariable &var)
 {
     switch (var.type)
     {
+        case GL_BOOL:
+            return TType(EbtBool);
+        case GL_BOOL_VEC2:
+            return TType(EbtBool, 2);
+        case GL_BOOL_VEC3:
+            return TType(EbtBool, 3);
+        case GL_BOOL_VEC4:
+            return TType(EbtBool, 4);
         case GL_FLOAT:
             return TType(EbtFloat);
         case GL_FLOAT_VEC2: