Validate global initializer qualifiers
Allow only constants, other globals, temporaries, and uniforms to be used
in global variable initialization for now. The spec limits global
variable initialization further to only constant expressions, but fully
implementing this has a too large compatibility cost for ESSL 1.00, so
implement it only partially. In the case of ESSL 3.00 we can use stricter
validation, since there's no legacy to worry about.
Resubmitting the change, since the previous version neglected to remove
incorrect GLSL tests.
TEST=angle_unittests, WebGL conformance tests, angle_end2end_tests
BUG=angleproject:988
Change-Id: I1bb3b8dc305689a90eadfe8cc7705e5ac3829e03
Reviewed-on: https://chromium-review.googlesource.com/270651
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ValidateGlobalInitializer.h b/src/compiler/translator/ValidateGlobalInitializer.h
new file mode 100644
index 0000000..28c005b
--- /dev/null
+++ b/src/compiler/translator/ValidateGlobalInitializer.h
@@ -0,0 +1,16 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
+#define COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
+
+class TIntermTyped;
+struct TParseContext;
+
+// Returns true if the initializer is valid.
+bool ValidateGlobalInitializer(TIntermTyped *initializer, const TParseContext *context, bool *warning);
+
+#endif // COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_