Disallow texture lookup functions in global initializers

Do this by simply disallowing all function calls in global initializers
- all built-in math ops are handled as other ops, not function calls.

This change was tested extensively with popular WebGL content, with no
regressions found.

TEST=angle_unittests
BUG=angleproject:988

Change-Id: Id1107fa294ae4012d5dd3949539d0b7b4cd21943
Reviewed-on: https://chromium-review.googlesource.com/283703
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ValidateGlobalInitializer.cpp b/src/compiler/translator/ValidateGlobalInitializer.cpp
index 918cb85..2461b6a 100644
--- a/src/compiler/translator/ValidateGlobalInitializer.cpp
+++ b/src/compiler/translator/ValidateGlobalInitializer.cpp
@@ -64,8 +64,9 @@
 
 bool ValidateGlobalInitializerTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
 {
-    // Disallow calls to user-defined functions in global variable initializers.
-    if (node->getOp() == EOpFunctionCall && node->isUserDefined())
+    // Disallow calls to user-defined functions and texture lookup functions in global variable initializers.
+    // This is done simply by disabling all function calls - built-in math functions don't use EOpFunctionCall.
+    if (node->getOp() == EOpFunctionCall)
     {
         mIsValid = false;
     }