Add compute shader special variables

Support is added for the compute shader special variables given in
OpenGL GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables.
Unit tests are added for legal and illegal usage of the special
variables.

BUG=angleproject:1442

TEST=angle_unittests

Change-Id: Idb25811c15c4044c55c611c0e73ef26eb5b3e9d7
Reviewed-on: https://chromium-review.googlesource.com/366661
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 33ec8c0..33ec5bb 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -340,6 +340,24 @@
         case EvqPointCoord:
             message = "can't modify gl_PointCoord";
             break;
+        case EvqNumWorkGroups:
+            message = "can't modify gl_NumWorkGroups";
+            break;
+        case EvqWorkGroupSize:
+            message = "can't modify gl_WorkGroupSize";
+            break;
+        case EvqWorkGroupID:
+            message = "can't modify gl_WorkGroupID";
+            break;
+        case EvqLocalInvocationID:
+            message = "can't modify gl_LocalInvocationID";
+            break;
+        case EvqGlobalInvocationID:
+            message = "can't modify gl_GlobalInvocationID";
+            break;
+        case EvqLocalInvocationIndex:
+            message = "can't modify gl_LocalInvocationIndex";
+            break;
         case EvqComputeIn:
             message = "can't modify work group size variable";
             break;
@@ -1246,6 +1264,15 @@
             error(location, errorMessage, name->c_str());
             recover();
         }
+
+        // GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables
+        if (getShaderType() == GL_COMPUTE_SHADER && !mComputeShaderLocalSizeDeclared &&
+            qualifier == EvqWorkGroupSize)
+        {
+            error(location,
+                  "It is an error to use gl_WorkGroupSize before declaring the local group size",
+                  "gl_WorkGroupSize");
+        }
     }
 
     if (!variable)