Don't accept default precision for uint

Default precision can only be specified for float, int and sampler types.
Default precision for int also applies to uint and uvec declarations.

BUG=angleproject:1221
TEST=angle_unittests

Change-Id: I31fdcde80da16e2ea8771838f7c1a6ab4e478194
Reviewed-on: https://chromium-review.googlesource.com/313314
Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/SymbolTable.h b/src/compiler/translator/SymbolTable.h
index 2f5eb36..3ceabdc 100644
--- a/src/compiler/translator/SymbolTable.h
+++ b/src/compiler/translator/SymbolTable.h
@@ -435,6 +435,8 @@
     {
         if (!SupportsPrecision(type.type))
             return false;
+        if (type.type == EbtUInt)
+            return false;  // ESSL 3.00.4 section 4.5.4
         if (type.isAggregate())
             return false; // Not allowed to set for aggregate types
         int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
diff --git a/src/tests/compiler_tests/MalformedShader_test.cpp b/src/tests/compiler_tests/MalformedShader_test.cpp
index 6e6d06c..9b83dd5 100644
--- a/src/tests/compiler_tests/MalformedShader_test.cpp
+++ b/src/tests/compiler_tests/MalformedShader_test.cpp
@@ -1315,3 +1315,22 @@
         FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
     }
 }
+
+// Test that default precision qualifier for uint is not accepted.
+// ESSL 3.00.4 section 4.5.4: Only allowed for float, int and sampler types.
+TEST_F(MalformedShaderTest, DefaultPrecisionUint)
+{
+    const std::string &shaderString =
+        "#version 300 es\n"
+        "precision mediump float;\n"
+        "precision mediump uint;\n"
+        "out vec4 my_FragColor;\n"
+        "void main()\n"
+        "{\n"
+        "   my_FragColor = vec4(0.0);\n"
+        "}\n";
+    if (compile(shaderString))
+    {
+        FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
+    }
+}
diff --git a/src/tests/compiler_tests/TypeTracking_test.cpp b/src/tests/compiler_tests/TypeTracking_test.cpp
index 10b63a1..516c94a 100644
--- a/src/tests/compiler_tests/TypeTracking_test.cpp
+++ b/src/tests/compiler_tests/TypeTracking_test.cpp
@@ -297,7 +297,7 @@
     const std::string &shaderString =
         "#version 300 es\n"
         "precision mediump float;\n"
-        "precision mediump uint;\n"
+        "precision mediump int;\n"
         "uniform vec2 uv;\n"
         "out vec4 my_FragColor;\n"
         "void main() {\n"
@@ -323,7 +323,7 @@
     const std::string &shaderString =
         "#version 300 es\n"
         "precision mediump float;\n"
-        "precision mediump uint;\n"
+        "precision mediump int;\n"
         "uniform uint uu;\n"
         "out vec4 my_FragColor;\n"
         "void main() {\n"
@@ -347,7 +347,7 @@
     const std::string &shaderString =
         "#version 300 es\n"
         "precision highp float;\n"
-        "precision highp uint;\n"
+        "precision highp int;\n"
         "uniform uint uu;\n"
         "out vec4 my_FragColor;\n"
         "void main() {\n"