allow renaming of shader entry point when creating SPIR-V

Use "--source-entrypoint name" on the command line, or the
TShader::setSourceEntryPoint(char*) API.

When the name given to the above interfaces is detected in the
shader source, it will be renamed to the entry point name supplied
to the -e option or the TShader::setEntryPoint() method.
This commit is contained in:
steve-lunarg
2016-10-31 15:13:43 -06:00
parent 8ce6e2ba49
commit f1e0c87127
9 changed files with 199 additions and 10 deletions

View File

@@ -47,6 +47,7 @@ class HlslParseContext : public TParseContextBase {
public:
HlslParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins,
int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&,
const TString sourceEntryPointName,
bool forwardCompatible = false, EShMessages messages = EShMsgDefault);
virtual ~HlslParseContext();
void initializeExtensionBehavior();
@@ -165,6 +166,9 @@ public:
bool handleOutputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
// Potentially rename shader entry point function
void renameShaderFunction(TString*& name) const;
protected:
void inheritGlobalDefaults(TQualifier& dst) const;
TVariable* makeInternalVariable(const char* name, const TType&) const;
@@ -251,6 +255,8 @@ protected:
TMap<int, TVector<TVariable*>> flattenMap;
unsigned int nextInLocation;
unsigned int nextOutLocation;
TString sourceEntryPointName;
};
} // end namespace glslang