Non-Functional: Whitespace, comments, replace accidentally deleted comment.
- fixed ParseHelper.cpp newlines (crlf -> lf) - removed trailing white space in most source files - fix some spelling issues - extra blank lines - tabs to spaces - replace #include comment about no location
This commit is contained in:
parent
3dd32293f4
commit
ecba76fe73
60 changed files with 755 additions and 806 deletions
|
|
@ -194,11 +194,11 @@ enum EPrecisionClass {
|
|||
EPcCount
|
||||
};
|
||||
|
||||
// A process-global symbol table per version per profile for built-ins common
|
||||
// to multiple stages (languages), and a process-global symbol table per version
|
||||
// A process-global symbol table per version per profile for built-ins common
|
||||
// to multiple stages (languages), and a process-global symbol table per version
|
||||
// per profile per stage for built-ins unique to each stage. They will be sparsely
|
||||
// populated, so they will only be generated as needed.
|
||||
//
|
||||
//
|
||||
// Each has a different set of built-ins, and we want to preserve that from
|
||||
// compile to compile.
|
||||
//
|
||||
|
|
@ -214,10 +214,10 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
|||
EShSource source, TInfoSink& infoSink, TSymbolTable& symbolTable)
|
||||
{
|
||||
TIntermediate intermediate(language, version, profile);
|
||||
|
||||
|
||||
intermediate.setSource(source);
|
||||
|
||||
std::unique_ptr<TParseContextBase> parseContext(CreateParseContext(symbolTable, intermediate, version, profile, source,
|
||||
std::unique_ptr<TParseContextBase> parseContext(CreateParseContext(symbolTable, intermediate, version, profile, source,
|
||||
language, infoSink, spvVersion, true, EShMsgDefault,
|
||||
true));
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
|||
TScanContext scanContext(*parseContext);
|
||||
parseContext->setScanContext(&scanContext);
|
||||
parseContext->setPpContext(&ppContext);
|
||||
|
||||
|
||||
//
|
||||
// Push the symbol table to give it an initial scope. This
|
||||
// push should not have a corresponding pop, so that built-ins
|
||||
|
|
@ -242,7 +242,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
|||
|
||||
if (builtInLengths[0] == 0)
|
||||
return true;
|
||||
|
||||
|
||||
TInputScanner input(1, builtInShaders, builtInLengths);
|
||||
if (! parseContext->parseShaderStrings(ppContext, input) != 0) {
|
||||
infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
|
||||
|
|
@ -330,7 +330,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
|||
EProfile profile, const SpvVersion& spvVersion, EShLanguage language, EShSource source)
|
||||
{
|
||||
std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source));
|
||||
|
||||
|
||||
builtInParseables->initialize(*resources, version, profile, spvVersion, language);
|
||||
InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spvVersion, language, source, infoSink, symbolTable);
|
||||
builtInParseables->identifyBuiltIns(version, profile, spvVersion, language, symbolTable, *resources);
|
||||
|
|
@ -339,7 +339,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
|||
}
|
||||
|
||||
//
|
||||
// To do this on the fly, we want to leave the current state of our thread's
|
||||
// To do this on the fly, we want to leave the current state of our thread's
|
||||
// pool allocator intact, so:
|
||||
// - Switch to a new pool for parsing the built-ins
|
||||
// - Do the parsing, which builds the symbol table, using the new pool
|
||||
|
|
@ -402,7 +402,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
|
|||
[versionIndex][spvVersionIndex][profileIndex][sourceIndex][CommonIndex(profile, (EShLanguage)stage)]);
|
||||
SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->copyTable(*stageTables[stage]);
|
||||
SharedSymbolTables[versionIndex][spvVersionIndex][profileIndex][sourceIndex][stage]->readOnly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up the local tables before deleting the pool they used.
|
||||
|
|
@ -471,7 +471,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
|
|||
profile = ECoreProfile;
|
||||
else
|
||||
profile = ENoProfile;
|
||||
}
|
||||
}
|
||||
// else: typical desktop case... e.g., "#version 410 core"
|
||||
}
|
||||
}
|
||||
|
|
@ -628,7 +628,7 @@ bool ProcessDeferred(
|
|||
|
||||
if (numStrings == 0)
|
||||
return true;
|
||||
|
||||
|
||||
// Move to length-based strings, rather than null-terminated strings.
|
||||
// Also, add strings to include the preamble and to ensure the shader is not null,
|
||||
// which lets the grammar accept what was a null (post preprocessing) shader.
|
||||
|
|
@ -710,24 +710,24 @@ bool ProcessDeferred(
|
|||
if (spvVersion.vulkan >= 100)
|
||||
intermediate.setOriginUpperLeft();
|
||||
SetupBuiltinSymbolTable(version, profile, spvVersion, source);
|
||||
|
||||
|
||||
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
|
||||
[MapSpvVersionToIndex(spvVersion)]
|
||||
[MapProfileToIndex(profile)]
|
||||
[MapSourceToIndex(source)]
|
||||
[compiler->getLanguage()];
|
||||
|
||||
|
||||
// Dynamically allocate the symbol table so we can control when it is deallocated WRT the pool.
|
||||
TSymbolTable* symbolTableMemory = new TSymbolTable;
|
||||
TSymbolTable& symbolTable = *symbolTableMemory;
|
||||
if (cachedTable)
|
||||
symbolTable.adoptLevels(*cachedTable);
|
||||
|
||||
|
||||
// Add built-in symbols that are potentially context dependent;
|
||||
// they get popped again further down.
|
||||
AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spvVersion,
|
||||
compiler->getLanguage(), source);
|
||||
|
||||
|
||||
//
|
||||
// Now we can process the full shader under proper symbols and rules.
|
||||
//
|
||||
|
|
@ -754,7 +754,7 @@ bool ProcessDeferred(
|
|||
}
|
||||
|
||||
parseContext->initializeExtensionBehavior();
|
||||
|
||||
|
||||
// Fill in the strings as outlined above.
|
||||
std::string preamble;
|
||||
parseContext->getPreamble(preamble);
|
||||
|
|
@ -978,7 +978,7 @@ struct DoFullParse{
|
|||
bool operator()(TParseContextBase& parseContext, TPpContext& ppContext,
|
||||
TInputScanner& fullInput, bool versionWillBeError,
|
||||
TSymbolTable&, TIntermediate& intermediate,
|
||||
EShOptimizationLevel optLevel, EShMessages messages)
|
||||
EShOptimizationLevel optLevel, EShMessages messages)
|
||||
{
|
||||
bool success = true;
|
||||
// Parse the full shader.
|
||||
|
|
@ -1032,7 +1032,6 @@ bool PreprocessDeferred(
|
|||
false, includer);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// do a partial compile on the given strings for a single compilation unit
|
||||
// for a potential deferred link into a single stage (and deferred full compile of that
|
||||
|
|
@ -1041,7 +1040,7 @@ bool PreprocessDeferred(
|
|||
// all preprocessing, parsing, semantic checks, etc. for a single compilation unit
|
||||
// are done here.
|
||||
//
|
||||
// return: the tree and other information is filled into the intermediate argument,
|
||||
// return: the tree and other information is filled into the intermediate argument,
|
||||
// and true is returned by the function for success.
|
||||
//
|
||||
bool CompileDeferred(
|
||||
|
|
@ -1072,7 +1071,6 @@ bool CompileDeferred(
|
|||
|
||||
} // end anonymous namespace for local functions
|
||||
|
||||
|
||||
//
|
||||
// ShInitialize() should be called exactly once per process, not per thread.
|
||||
//
|
||||
|
|
@ -1103,7 +1101,7 @@ ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions)
|
|||
return 0;
|
||||
|
||||
TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, debugOptions));
|
||||
|
||||
|
||||
return reinterpret_cast<void*>(base);
|
||||
}
|
||||
|
||||
|
|
@ -1264,8 +1262,7 @@ int ShLinkExt(
|
|||
}
|
||||
if (base->getAsCompiler())
|
||||
cObjects.push_back(base->getAsCompiler());
|
||||
|
||||
|
||||
|
||||
if (cObjects[i] == 0)
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1281,7 +1278,7 @@ int ShLinkExt(
|
|||
for (int i = 0; i < numHandles; ++i) {
|
||||
if (cObjects[i]->getAsCompiler()) {
|
||||
if (! cObjects[i]->getAsCompiler()->linkable()) {
|
||||
linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code.");
|
||||
linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1340,7 +1337,7 @@ const void* ShGetExecutable(const ShHandle handle)
|
|||
return 0;
|
||||
|
||||
TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
|
||||
|
||||
|
||||
TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
|
||||
if (linker == 0)
|
||||
return 0;
|
||||
|
|
@ -1357,7 +1354,7 @@ const void* ShGetExecutable(const ShHandle handle)
|
|||
// success or failure.
|
||||
//
|
||||
int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table)
|
||||
{
|
||||
{
|
||||
if (!InitThread())
|
||||
return 0;
|
||||
|
||||
|
|
@ -1369,7 +1366,7 @@ int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* t
|
|||
|
||||
if (linker == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
linker->setAppAttributeBindings(table);
|
||||
|
||||
return 1;
|
||||
|
|
@ -1446,7 +1443,7 @@ int ShGetUniformLocation(const ShHandle handle, const char* name)
|
|||
//
|
||||
// Below is a new alternate C++ interface that might potentially replace the above
|
||||
// opaque handle-based interface.
|
||||
//
|
||||
//
|
||||
// See more detailed comment in ShaderLang.h
|
||||
//
|
||||
|
||||
|
|
@ -1552,7 +1549,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
|||
{
|
||||
if (! InitThread())
|
||||
return false;
|
||||
|
||||
|
||||
pool = new TPoolAllocator();
|
||||
SetThreadPoolAllocator(*pool);
|
||||
if (! preamble)
|
||||
|
|
@ -1636,7 +1633,7 @@ bool TProgram::link(EShMessages messages)
|
|||
linked = true;
|
||||
|
||||
bool error = false;
|
||||
|
||||
|
||||
pool = new TPoolAllocator();
|
||||
SetThreadPoolAllocator(*pool);
|
||||
|
||||
|
|
@ -1723,7 +1720,7 @@ const char* TProgram::getInfoDebugLog()
|
|||
//
|
||||
|
||||
bool TProgram::buildReflection()
|
||||
{
|
||||
{
|
||||
if (! linked || reflection)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue