Simultaneously fix only known memory leak and take the next step in supporting arrays of arrays. Improved several minor things along the way.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20514 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-02-11 00:54:44 +00:00
parent 6968b823ef
commit dadf945fd7
14 changed files with 274 additions and 109 deletions

View file

@ -194,13 +194,11 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language
GlobalParseContext = &parseContext;
setInitialState();
assert(symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());
//
// Parse the built-ins. This should only happen once per
// language symbol table.
// language symbol table when no 'resources' are passed in.
//
// Push the symbol table to give it an initial scope. This
// push should not have a corresponding pop, so that built-ins
@ -208,6 +206,7 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language
//
symbolTable->push();
//Initialize the Preprocessor
int ret = InitPreprocessor();
@ -215,6 +214,8 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language
infoSink.info.message(EPrefixInternalError, "Unable to intialize the Preprocessor");
return false;
}
ResetFlex();
for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();
i != BuiltInStrings[parseContext.language].end(); ++i) {
@ -229,15 +230,13 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language
return false;
}
}
FinalizePreprocessor();
if (resources) {
IdentifyBuiltIns(parseContext.language, *symbolTable, *resources);
} else {
} else {
IdentifyBuiltIns(parseContext.language, *symbolTable);
}
FinalizePreprocessor();
return true;
}
@ -279,6 +278,8 @@ int ShCompile(
TIntermediate intermediate(compiler->infoSink);
TSymbolTable symbolTable(SymbolTables[compiler->getLanguage()]);
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
GenerateBuiltInSymbolTable(resources, compiler->infoSink, &symbolTable, compiler->getLanguage());
TParseContext parseContext(symbolTable, intermediate, compiler->getLanguage(), compiler->infoSink, defaultVersion);
@ -286,9 +287,9 @@ int ShCompile(
GlobalParseContext = &parseContext;
setInitialState();
ResetFlex();
InitPreprocessor();
InitPreprocessor();
//
// Parse the application's shaders. All the following symbol table
// work will be throw-away, so push a new allocation scope that can