diff options
Diffstat (limited to 'gfx/angle/src/tests/test_utils/compiler_test.cpp')
-rwxr-xr-x | gfx/angle/src/tests/test_utils/compiler_test.cpp | 98 |
1 files changed, 8 insertions, 90 deletions
diff --git a/gfx/angle/src/tests/test_utils/compiler_test.cpp b/gfx/angle/src/tests/test_utils/compiler_test.cpp index 873541ecd..ea758b893 100755 --- a/gfx/angle/src/tests/test_utils/compiler_test.cpp +++ b/gfx/angle/src/tests/test_utils/compiler_test.cpp @@ -11,79 +11,16 @@ #include "angle_gl.h" #include "compiler/translator/Compiler.h" -namespace sh -{ - -namespace -{ - -class ShaderVariableFinder : public TIntermTraverser -{ - public: - ShaderVariableFinder(const TString &variableName, TBasicType basicType) - : TIntermTraverser(true, false, false), - mVariableName(variableName), - mNodeFound(nullptr), - mBasicType(basicType) - { - } - - void visitSymbol(TIntermSymbol *node) - { - if (node->getBasicType() == mBasicType && node->getSymbol() == mVariableName) - { - mNodeFound = node; - } - } - - bool isFound() const { return mNodeFound != nullptr; } - const TIntermSymbol *getNode() const { return mNodeFound; } - - private: - TString mVariableName; - TIntermSymbol *mNodeFound; - TBasicType mBasicType; -}; - -class FunctionCallFinder : public TIntermTraverser -{ - public: - FunctionCallFinder(const TString &functionName) - : TIntermTraverser(true, false, false), mFunctionName(functionName), mNodeFound(nullptr) - { - } - - bool visitAggregate(Visit visit, TIntermAggregate *node) override - { - if (node->getOp() == EOpFunctionCall && - node->getFunctionSymbolInfo()->getName() == mFunctionName) - { - mNodeFound = node; - return false; - } - return true; - } - - bool isFound() const { return mNodeFound != nullptr; } - const TIntermAggregate *getNode() const { return mNodeFound; } - - private: - TString mFunctionName; - TIntermAggregate *mNodeFound; -}; - -} // anonymous namespace - bool compileTestShader(GLenum type, ShShaderSpec spec, ShShaderOutput output, const std::string &shaderString, ShBuiltInResources *resources, - ShCompileOptions compileOptions, + int compileOptions, std::string *translatedCode, std::string *infoLog) { - sh::TCompiler *translator = sh::ConstructCompiler(type, spec, output); + TCompiler *translator = ConstructCompiler(type, spec, output); if (!translator->Init(*resources)) { SafeDelete(translator); @@ -106,21 +43,21 @@ bool compileTestShader(GLenum type, ShShaderSpec spec, ShShaderOutput output, const std::string &shaderString, - ShCompileOptions compileOptions, + int compileOptions, std::string *translatedCode, std::string *infoLog) { ShBuiltInResources resources; - sh::InitBuiltInResources(&resources); + ShInitBuiltInResources(&resources); return compileTestShader(type, spec, output, shaderString, &resources, compileOptions, translatedCode, infoLog); } MatchOutputCodeTest::MatchOutputCodeTest(GLenum shaderType, - ShCompileOptions defaultCompileOptions, + int defaultCompileOptions, ShShaderOutput outputType) : mShaderType(shaderType), mDefaultCompileOptions(defaultCompileOptions) { - sh::InitBuiltInResources(&mResources); + ShInitBuiltInResources(&mResources); mOutputCode[outputType] = std::string(); } @@ -139,8 +76,7 @@ void MatchOutputCodeTest::compile(const std::string &shaderString) compile(shaderString, mDefaultCompileOptions); } -void MatchOutputCodeTest::compile(const std::string &shaderString, - const ShCompileOptions compileOptions) +void MatchOutputCodeTest::compile(const std::string &shaderString, const int compileOptions) { std::string infoLog; for (auto &code : mOutputCode) @@ -156,7 +92,7 @@ void MatchOutputCodeTest::compile(const std::string &shaderString, bool MatchOutputCodeTest::compileWithSettings(ShShaderOutput output, const std::string &shaderString, - const ShCompileOptions compileOptions, + const int compileOptions, std::string *translatedCode, std::string *infoLog) { @@ -236,21 +172,3 @@ bool MatchOutputCodeTest::notFoundInCode(const char *stringToFind) const } return true; } - -const TIntermSymbol *FindSymbolNode(TIntermNode *root, - const TString &symbolName, - TBasicType basicType) -{ - ShaderVariableFinder finder(symbolName, basicType); - root->traverse(&finder); - return finder.getNode(); -} - -const TIntermAggregate *FindFunctionCallNode(TIntermNode *root, const TString &functionName) -{ - FunctionCallFinder finder(functionName); - root->traverse(&finder); - return finder.getNode(); -} - -} // namespace sh |