Remove repeated "success" check from compileTreeImpl
This refactoring simplifies the compilation code by putting AST checks
and simplification into a separate function. This function will
immediately return false when an error is encountered. This is easier
to maintain than repeated checking of a "success" boolean.
BUG=angleproject:2068
TEST=WebGL conformance tests, angle_unittests, angle_end2end_tests
Change-Id: I1ae1c8def3625ada1482104a6babe605405229ef
Reviewed-on: https://chromium-review.googlesource.com/750085
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Compiler.h b/src/compiler/translator/Compiler.h
index 7dd5ac0..cd09eef 100644
--- a/src/compiler/translator/Compiler.h
+++ b/src/compiler/translator/Compiler.h
@@ -30,6 +30,7 @@
{
class TCompiler;
+class TParseContext;
#ifdef ANGLE_ENABLE_HLSL
class TranslatorHLSL;
#endif // ANGLE_ENABLE_HLSL
@@ -218,12 +219,21 @@
// Removes unused function declarations and prototypes from the AST
class UnusedPredicate;
- bool pruneUnusedFunctions(TIntermBlock *root);
+ void pruneUnusedFunctions(TIntermBlock *root);
TIntermBlock *compileTreeImpl(const char *const shaderStrings[],
size_t numStrings,
const ShCompileOptions compileOptions);
+ // Fetches and stores shader metadata that is not stored within the AST itself, such as shader
+ // version.
+ void setASTMetadata(const TParseContext &parseContext);
+
+ // Does checks that need to be run after parsing is complete and returns true if they pass.
+ bool checkAndSimplifyAST(TIntermBlock *root,
+ const TParseContext &parseContext,
+ ShCompileOptions compileOptions);
+
sh::GLenum shaderType;
ShShaderSpec shaderSpec;
ShShaderOutput outputType;