Rationalize naming/access to current thread-local-storage scheme. However, the preprocessor tokenizer is not thread-safe, so this may all change.

Also adding missing test.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22249 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-07-02 20:18:59 +00:00
parent 1fde51d3fb
commit 73ed17a87b
10 changed files with 48 additions and 21 deletions

View file

@ -100,7 +100,7 @@ bool InitializeSymbolTable(TBuiltInStrings* BuiltInStrings, int version, EProfil
TParseContext parseContext(*symbolTable, intermediate, true, version, profile, language, infoSink);
GlobalParseContext = &parseContext;
ThreadLocalParseContext() = &parseContext;
assert(symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());
@ -259,15 +259,14 @@ bool DeduceProfile(TInfoSink& infoSink, int version, EProfile& profile)
}; // end anonymous namespace for local functions
//
// ShInitialize() should be called exactly once per process, not per thread.
//
int ShInitialize()
{
if (! InitProcess())
return 0;
// TODO: Quality: Thread safety:
// This method should be called once per process. If it's called by multiple threads, then
// we need to have thread synchronization code around the initialization of per process
// global pool allocator
if (! PerProcessGPA) {
PerProcessGPA = new TPoolAllocator(true);
}
@ -422,7 +421,7 @@ int ShCompile(
else if (profile == EEsProfile && version >= 300 && versionNotFirst)
parseContext.error(1, "statement must appear first in ESSL shader; before comments or newlines", "#version", "");
GlobalParseContext = &parseContext;
ThreadLocalParseContext() = &parseContext;
ResetFlex();
InitPreprocessor();