Use TLValueTrackingTraverser in ValidateLimitations
Use TLValueTrackingTraverser to determine whether a loop index is used
as an l-value. This replaces custom logic in ValidateLimitations,
greatly simplifying the code. Also pass the symbol table to
ValidateLimitations as a parameter, which removes the need to store a
global pointer to the current ParseContext.
BUG=angleproject:1960
TEST=angle_unittests, WebGL conformance tests
Change-Id: I122c85c78bbea05833d7c787cd184de568c5c45f
Reviewed-on: https://chromium-review.googlesource.com/465606
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 9cedfab..a09c505 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -17,7 +17,6 @@
#include "compiler/translator/EmulateGLFragColorBroadcast.h"
#include "compiler/translator/EmulatePrecision.h"
#include "compiler/translator/Initialize.h"
-#include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/InitializeVariables.h"
#include "compiler/translator/ParseContext.h"
#include "compiler/translator/PruneEmptyDeclarations.h"
@@ -293,7 +292,6 @@
compileOptions, true, &mDiagnostics, getResources());
parseContext.setFragmentPrecisionHighOnESSL1(fragmentPrecisionHigh);
- SetGlobalParseContext(&parseContext);
// We preserve symbols at the built-in level from compile-to-compile.
// Start pushing the user-defined symbols at global level.
@@ -368,7 +366,8 @@
success = validateOutputs(root);
if (success && shouldRunLoopAndIndexingValidation(compileOptions))
- success = validateLimitations(root);
+ success =
+ ValidateLimitations(root, shaderType, symbolTable, shaderVersion, &mDiagnostics);
bool multiview2 = IsExtensionEnabled(extensionBehavior, "GL_OVR_multiview2");
if (success && compileResources.OVR_multiview && IsWebGLBasedSpec(shaderSpec) &&
@@ -477,7 +476,6 @@
}
}
- SetGlobalParseContext(NULL);
if (success)
return root;
@@ -854,13 +852,6 @@
return (mDiagnostics.numErrors() == 0);
}
-bool TCompiler::validateLimitations(TIntermNode *root)
-{
- ValidateLimitations validate(shaderType, &mDiagnostics);
- root->traverse(&validate);
- return mDiagnostics.numErrors() == 0;
-}
-
bool TCompiler::limitExpressionComplexity(TIntermNode *root)
{
TMaxDepthTraverser traverser(maxExpressionComplexity + 1);