HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.
This needs some render testing, but is destined to be part of master. This also leads to a variety of other simplifications. - IO are global symbols, so only need one list of linkage nodes (deferred) - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized - several parts of splitting/flattening are now localized
This commit is contained in:
parent
18adbdbbb8
commit
02467d8d94
171 changed files with 37604 additions and 32679 deletions
|
|
@ -2,5 +2,5 @@
|
|||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1805"
|
||||
#define GLSLANG_DATE "02-Feb-2017"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1780"
|
||||
#define GLSLANG_DATE "20-Jan-2017"
|
||||
|
|
|
|||
|
|
@ -223,20 +223,11 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op,
|
|||
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
|
||||
}
|
||||
|
||||
// Add a linkage symbol node for 'symbol', which
|
||||
// must have its type fully edited, as this will snapshot the type.
|
||||
// It is okay if symbol becomes invalid before finish().
|
||||
void TParseContextBase::trackLinkage(TSymbol& symbol)
|
||||
{
|
||||
if (!parsingBuiltins)
|
||||
intermediate.addSymbolLinkageNode(linkage, symbol);
|
||||
}
|
||||
|
||||
// Add 'symbol' to the list of deferred linkage symbols, which
|
||||
// are later processed in finish(), at which point the symbol
|
||||
// must still be valid.
|
||||
// It is okay if the symbol's type will be subsequently edited.
|
||||
void TParseContextBase::trackLinkageDeferred(TSymbol& symbol)
|
||||
void TParseContextBase::trackLinkage(TSymbol& symbol)
|
||||
{
|
||||
if (!parsingBuiltins)
|
||||
linkageSymbols.push_back(&symbol);
|
||||
|
|
@ -253,7 +244,7 @@ void TParseContextBase::makeEditable(TSymbol*& symbol)
|
|||
|
||||
// Save it (deferred, so it can be edited first) in the AST for linker use.
|
||||
if (symbol)
|
||||
trackLinkageDeferred(*symbol);
|
||||
trackLinkage(*symbol);
|
||||
}
|
||||
|
||||
// Return a writable version of the variable 'name'.
|
||||
|
|
@ -577,7 +568,7 @@ bool TParseContextBase::insertGlobalUniformBlock()
|
|||
// This is the first request; we need a normal symbol table insert
|
||||
inserted = symbolTable.insert(*globalUniformBlock);
|
||||
if (inserted)
|
||||
trackLinkageDeferred(*globalUniformBlock);
|
||||
trackLinkage(*globalUniformBlock);
|
||||
} else if (firstNewMember <= numMembers) {
|
||||
// This is a follow-on request; we need to amend the first insert
|
||||
inserted = symbolTable.amend(*globalUniformBlock, firstNewMember);
|
||||
|
|
@ -593,12 +584,14 @@ bool TParseContextBase::insertGlobalUniformBlock()
|
|||
|
||||
void TParseContextBase::finish()
|
||||
{
|
||||
if (!parsingBuiltins) {
|
||||
// Transfer the linkage symbols to AST nodes
|
||||
for (auto i = linkageSymbols.begin(); i != linkageSymbols.end(); ++i)
|
||||
intermediate.addSymbolLinkageNode(linkage, **i);
|
||||
intermediate.addSymbolLinkageNodes(linkage, getLanguage(), symbolTable);
|
||||
}
|
||||
if (parsingBuiltins)
|
||||
return;
|
||||
|
||||
// Transfer the linkage symbols to AST nodes
|
||||
TIntermAggregate* linkage = new TIntermAggregate;
|
||||
for (auto i = linkageSymbols.begin(); i != linkageSymbols.end(); ++i)
|
||||
intermediate.addSymbolLinkageNode(linkage, **i);
|
||||
intermediate.addSymbolLinkageNodes(linkage, getLanguage(), symbolTable);
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -3009,7 +3009,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, TString& identifier, con
|
|||
symbol = new TVariable(&identifier, type);
|
||||
symbolTable.insert(*symbol);
|
||||
if (symbolTable.atGlobalLevel())
|
||||
trackLinkageDeferred(*symbol);
|
||||
trackLinkage(*symbol);
|
||||
|
||||
if (! symbolTable.atBuiltInLevel()) {
|
||||
if (isIoResizeArray(type)) {
|
||||
|
|
@ -3476,7 +3476,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
fixIoArraySize(loc, block->getWritableType());
|
||||
|
||||
// Save it in the AST for linker use.
|
||||
trackLinkageDeferred(*block);
|
||||
trackLinkage(*block);
|
||||
}
|
||||
|
||||
void TParseContext::paramCheckFix(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type)
|
||||
|
|
@ -5056,7 +5056,7 @@ TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, TString& identi
|
|||
// add variable to symbol table
|
||||
if (symbolTable.insert(*variable)) {
|
||||
if (symbolTable.atGlobalLevel())
|
||||
trackLinkageDeferred(*variable);
|
||||
trackLinkage(*variable);
|
||||
return variable;
|
||||
}
|
||||
|
||||
|
|
@ -5718,7 +5718,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
fixIoArraySize(loc, variable.getWritableType());
|
||||
|
||||
// Save it in the AST for linker use.
|
||||
trackLinkageDeferred(variable);
|
||||
trackLinkage(variable);
|
||||
}
|
||||
|
||||
// Do all block-declaration checking regarding the combination of in/out/uniform/buffer
|
||||
|
|
|
|||
|
|
@ -79,9 +79,7 @@ public:
|
|||
symbolTable(symbolTable),
|
||||
parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr),
|
||||
globalUniformBlock(nullptr)
|
||||
{
|
||||
linkage = new TIntermAggregate;
|
||||
}
|
||||
{ }
|
||||
virtual ~TParseContextBase() { }
|
||||
|
||||
virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||
|
|
@ -183,13 +181,9 @@ protected:
|
|||
const char* szExtraInfoFormat, TPrefixType prefix,
|
||||
va_list args);
|
||||
virtual void trackLinkage(TSymbol& symbol);
|
||||
virtual void trackLinkageDeferred(TSymbol& symbol);
|
||||
virtual void makeEditable(TSymbol*&);
|
||||
virtual TVariable* getEditableVariable(const char* name);
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
TIntermAggregate* linkage;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -87,6 +87,12 @@ public:
|
|||
|
||||
virtual const TString& getName() const { return *name; }
|
||||
virtual void changeName(const TString* newName) { name = newName; }
|
||||
virtual void addPrefix(const char* prefix)
|
||||
{
|
||||
TString newName(prefix);
|
||||
newName.append(*name);
|
||||
changeName(NewPoolTString(newName.c_str()));
|
||||
}
|
||||
virtual const TString& getMangledName() const { return getName(); }
|
||||
virtual TFunction* getAsFunction() { return 0; }
|
||||
virtual const TFunction* getAsFunction() const { return 0; }
|
||||
|
|
@ -232,6 +238,11 @@ public:
|
|||
if (p.defaultValue != nullptr)
|
||||
defaultParamCount++;
|
||||
}
|
||||
virtual void addPrefix(const char* prefix) override
|
||||
{
|
||||
TSymbol::addPrefix(prefix);
|
||||
mangledName.insert(0, prefix);
|
||||
}
|
||||
|
||||
virtual const TString& getMangledName() const { return mangledName; }
|
||||
virtual const TType& getType() const { return returnType; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue