Fix wrong assignment of maxUniformVectors in GLSL compiler

This patch intends to fix a bug in ANGLE GLSL compiler.

In TCompiler::Init(resources), we should initialize maxUniformVectors by
resource.maxComputeUniformComponents / 4 when we attempt to initialize a
compiler for compute shader instead of resource.maxFragmentUniformVectors.

BUG=angleproject:2083

Change-Id: I4901f71ef5ac4f5770e2d5f8ee21786fcf19fbca
Reviewed-on: https://chromium-review.googlesource.com/545190
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index c975038..107494d 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -135,6 +135,23 @@
     }
 }
 
+int GetMaxUniformVectorsForShaderType(GLenum shaderType, const ShBuiltInResources &resources)
+{
+    switch (shaderType)
+    {
+        case GL_VERTEX_SHADER:
+            return resources.MaxVertexUniformVectors;
+        case GL_FRAGMENT_SHADER:
+            return resources.MaxFragmentUniformVectors;
+        case GL_COMPUTE_SHADER:
+            // TODO (jiawei.shao@intel.com): check if we need finer-grained component counting
+            return resources.MaxComputeUniformComponents / 4;
+        default:
+            UNIMPLEMENTED();
+            return -1;
+    }
+}
+
 namespace
 {
 
@@ -242,9 +259,10 @@
 
 bool TCompiler::Init(const ShBuiltInResources &resources)
 {
-    shaderVersion     = 100;
-    maxUniformVectors = (shaderType == GL_VERTEX_SHADER) ? resources.MaxVertexUniformVectors
-                                                         : resources.MaxFragmentUniformVectors;
+    shaderVersion = 100;
+
+    maxUniformVectors = GetMaxUniformVectorsForShaderType(shaderType, resources);
+
     maxExpressionComplexity = resources.MaxExpressionComplexity;
     maxCallStackDepth       = resources.MaxCallStackDepth;
     maxFunctionParameters   = resources.MaxFunctionParameters;