Fix allowing non-constant ternary global initializer
Check the qualifier of a node resulting from the folding of a ternary
node correctly. The folded node might even be a TIntermConstantUnion
with a non-constant qualifier.
BUG=angleproject:2285
TEST=angle_unittests
Change-Id: I74516e44ce9d78bc54093a5b58d14cf33a57e6e5
Reviewed-on: https://chromium-review.googlesource.com/829138
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index c6bd784..ed51367 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1933,7 +1933,7 @@
bool globalInitWarning = false;
if (symbolTable.atGlobalLevel() &&
- !ValidateGlobalInitializer(initializer, this, &globalInitWarning))
+ !ValidateGlobalInitializer(initializer, mShaderVersion, &globalInitWarning))
{
// Error message does not completely match behavior with ESSL 1.00, but
// we want to steer developers towards only using constant expressions.