Pass the shader version to the symbol table. This refactoring prepares for version-specific builtin symbol lookups. Bug 19331817 Change-Id: I65b46a2b35872802a249a45b2f97a1d3c1e35dfe Reviewed-on: https://swiftshader-review.googlesource.com/2330 Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp index d9e9dfd..0b14803 100644 --- a/src/OpenGL/compiler/ParseHelper.cpp +++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -741,7 +741,7 @@ bool builtIn = false; bool sameScope = false; - TSymbol* symbol = symbolTable.find(identifier, &builtIn, &sameScope); + TSymbol* symbol = symbolTable.find(identifier, shaderVersion, &builtIn, &sameScope); if (symbol == 0 || !sameScope) { if (reservedErrorCheck(line, identifier)) return true; @@ -800,7 +800,7 @@ bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, TSourceLoc line) { bool builtIn = false; - TSymbol* symbol = symbolTable.find(node->getSymbol(), &builtIn); + TSymbol* symbol = symbolTable.find(node->getSymbol(), shaderVersion, &builtIn); if (symbol == 0) { error(line, " undeclared identifier", node->getSymbol().c_str()); return true; @@ -813,7 +813,7 @@ // special casing to test index value of gl_FragData. If the accessed index is >= gl_MaxDrawBuffers // its an error if (node->getSymbol() == "gl_FragData") { - TSymbol* fragData = symbolTable.find("gl_MaxDrawBuffers", &builtIn); + TSymbol* fragData = symbolTable.find("gl_MaxDrawBuffers", shaderVersion, &builtIn); ASSERT(fragData); int fragDataValue = static_cast<TVariable*>(fragData)->getConstPointer()[0].getIConst(); @@ -974,9 +974,9 @@ { // First find by unmangled name to check whether the function name has been // hidden by a variable name or struct typename. - const TSymbol* symbol = symbolTable.find(call->getName(), builtIn); + const TSymbol* symbol = symbolTable.find(call->getName(), shaderVersion, builtIn); if (symbol == 0) { - symbol = symbolTable.find(call->getMangledName(), builtIn); + symbol = symbolTable.find(call->getMangledName(), shaderVersion, builtIn); } if (symbol == 0) { @@ -1056,7 +1056,7 @@ variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer()); } } else if (initializer->getAsSymbolNode()) { - const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol()); + const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), shaderVersion); const TVariable* tVar = static_cast<const TVariable*>(symbol); ConstantUnion* constArray = tVar->getConstPointer();