Track separate entry-point names and mangled names...
... and use each in the correct way at consumption sites. This completes issue #513.
This commit is contained in:
parent
632f575ecc
commit
eee9d536bc
8 changed files with 32 additions and 25 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.1496"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1499"
|
||||
#define GLSLANG_DATE "19-Sep-2016"
|
||||
|
|
|
|||
|
|
@ -1051,19 +1051,24 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
|
|||
currentFunctionType = new TType(EbtVoid);
|
||||
functionReturnsValue = false;
|
||||
|
||||
//
|
||||
// Raise error message if main function takes any parameters or returns anything other than void
|
||||
//
|
||||
if (function.getName() == intermediate.getEntryPoint().c_str()) {
|
||||
if (function.getParamCount() > 0)
|
||||
error(loc, "function cannot take any parameter(s)", function.getName().c_str(), "");
|
||||
if (function.getType().getBasicType() != EbtVoid)
|
||||
error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value");
|
||||
// Check for entry point
|
||||
if (function.getName().compare(intermediate.getEntryPointName().c_str()) == 0) {
|
||||
intermediate.setEntryPointMangledName(function.getMangledName().c_str());
|
||||
intermediate.incrementEntryPointCount();
|
||||
inMain = true;
|
||||
} else
|
||||
inMain = false;
|
||||
|
||||
//
|
||||
// Raise error message if main function takes any parameters or returns anything other than void
|
||||
//
|
||||
if (inMain) {
|
||||
if (function.getParamCount() > 0)
|
||||
error(loc, "function cannot take any parameter(s)", function.getName().c_str(), "");
|
||||
if (function.getType().getBasicType() != EbtVoid)
|
||||
error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value");
|
||||
}
|
||||
|
||||
//
|
||||
// New symbol table scope for body of function plus its arguments
|
||||
//
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ bool ProcessDeferred(
|
|||
parseContext = new HlslParseContext(symbolTable, intermediate, false, version, profile, spvVersion,
|
||||
compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages);
|
||||
} else {
|
||||
intermediate.setEntryPoint("main");
|
||||
intermediate.setEntryPointName("main");
|
||||
parseContext = new TParseContext(symbolTable, intermediate, false, version, profile, spvVersion,
|
||||
compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages);
|
||||
}
|
||||
|
|
@ -1485,7 +1485,7 @@ void TShader::setStringsWithLengthsAndNames(
|
|||
|
||||
void TShader::setEntryPoint(const char* entryPoint)
|
||||
{
|
||||
intermediate->setEntryPoint(entryPoint);
|
||||
intermediate->setEntryPointName(entryPoint);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
|
|||
if (source != unit.source)
|
||||
error(infoSink, "can't link compilation units from different source languages");
|
||||
|
||||
if (source == EShSourceHlsl && unit.entryPoint.size() > 0) {
|
||||
if (entryPoint.size() > 0)
|
||||
if (source == EShSourceHlsl && unit.entryPointName.size() > 0) {
|
||||
if (entryPointName.size() > 0)
|
||||
error(infoSink, "can't handle multiple entry points per stage");
|
||||
else
|
||||
entryPoint = unit.entryPoint;
|
||||
entryPointName = unit.entryPointName;
|
||||
}
|
||||
numEntryPoints += unit.numEntryPoints;
|
||||
numErrors += unit.numErrors;
|
||||
|
|
|
|||
|
|
@ -159,8 +159,10 @@ public:
|
|||
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
void setEntryPoint(const char* ep) { entryPoint = ep; }
|
||||
const std::string& getEntryPoint() const { return entryPoint; }
|
||||
void setEntryPointName(const char* ep) { entryPointName = ep; }
|
||||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
void setVersion(int v) { version = v; }
|
||||
int getVersion() const { return version; }
|
||||
void setProfile(EProfile p) { profile = p; }
|
||||
|
|
@ -363,7 +365,8 @@ protected:
|
|||
|
||||
const EShLanguage language; // stage, known at construction time
|
||||
EShSource source; // source language, known a bit later
|
||||
std::string entryPoint;
|
||||
std::string entryPointName;
|
||||
std::string entryPointMangledName;
|
||||
EProfile profile;
|
||||
int version;
|
||||
SpvVersion spvVersion;
|
||||
|
|
|
|||
|
|
@ -670,8 +670,8 @@ bool TReflection::addStage(EShLanguage, const TIntermediate& intermediate)
|
|||
|
||||
TReflectionTraverser it(intermediate, *this);
|
||||
|
||||
// put the entry point on functions to process
|
||||
it.pushFunction("main(");
|
||||
// put the entry point on the list of functions to process
|
||||
it.pushFunction(intermediate.getEntryPointMangledName().c_str());
|
||||
|
||||
// process all the functions
|
||||
while (! it.functions.empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue