SPV: Add OpSource shader source code and file name.

This commit is contained in:
John Kessenich 2017-05-31 17:11:16 -06:00
parent 136b1e2d5d
commit 121853f4df
12 changed files with 243 additions and 22 deletions

View file

@ -728,6 +728,11 @@ bool ProcessDeferred(
intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || (messages & EShMsgReadHlsl))
intermediate.setHlslOffsets();
if (messages & EShMsgDebugInfo) {
intermediate.setSourceFile(names[numPre]);
for (int s = 0; s < numStrings; ++s)
intermediate.addSourceText(strings[numPre]);
}
SetupBuiltinSymbolTable(version, profile, spvVersion, source);
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]

View file

@ -451,6 +451,11 @@ public:
return semanticNameSet.insert(name).first->c_str();
}
void setSourceFile(const char* file) { sourceFile = file; }
const std::string& getSourceFile() const { return sourceFile; }
void addSourceText(const char* text) { sourceText = sourceText + text; }
const std::string& getSourceText() const { return sourceText; }
const char* const implicitThisName = "@this";
protected:
@ -541,6 +546,10 @@ protected:
EShTextureSamplerTransformMode textureSamplerTransformMode;
// source code of shader, useful as part of debug information
std::string sourceFile;
std::string sourceText;
private:
void operator=(TIntermediate&); // prevent assignments
};