Added function to merge source files when linking shaders.
This commit is contained in:
parent
4438979baf
commit
ebdbba3643
@ -93,6 +93,7 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
|
||||
mergeCallGraphs(infoSink, unit);
|
||||
mergeModes(infoSink, unit);
|
||||
mergeTrees(infoSink, unit);
|
||||
mergeSources(infoSink, unit); // @MEWIN 2023-02-22 - Added function to merge source files when linking shaders.
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -378,6 +379,37 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit)
|
||||
ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end());
|
||||
}
|
||||
|
||||
// BEGIN @MEWIN - 2023-02-22 - Added function to merge source files when linking shaders.
|
||||
void TIntermediate::mergeSources(TInfoSink& infoSink, TIntermediate& unit)
|
||||
{
|
||||
auto addSource = [&](const char* name, const char* text, size_t len)
|
||||
{
|
||||
if (sourceFile == name) {
|
||||
return;
|
||||
}
|
||||
auto it = includeText.find(name);
|
||||
if (it != includeText.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceText.empty())
|
||||
{
|
||||
setSourceFile(name);
|
||||
addSourceText(text, len);
|
||||
}
|
||||
else {
|
||||
addIncludeText(name, text, len);
|
||||
}
|
||||
};
|
||||
if (!unit.getSourceFile().empty()) {
|
||||
addSource(unit.getSourceFile().c_str(), unit.getSourceText().c_str(), unit.getSourceText().length());
|
||||
}
|
||||
|
||||
for (const auto& [name, text] : unit.includeText) {
|
||||
addSource(name.c_str(), text.c_str(), text.length());
|
||||
}
|
||||
}
|
||||
// END @MEWIN
|
||||
#endif
|
||||
|
||||
static const TString& getNameForIdMap(TIntermSymbol* symbol)
|
||||
|
@ -1131,6 +1131,7 @@ protected:
|
||||
void mergeCallGraphs(TInfoSink&, TIntermediate&);
|
||||
void mergeModes(TInfoSink&, TIntermediate&);
|
||||
void mergeTrees(TInfoSink&, TIntermediate&);
|
||||
void mergeSources(TInfoSink&, TIntermediate&); // @MEWIN 2023-02-22 - Added function to merge source files when linking shaders.
|
||||
void seedIdMap(TIdMaps& idMaps, long long& IdShift);
|
||||
void remapIds(const TIdMaps& idMaps, long long idShift, TIntermediate&);
|
||||
void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals);
|
||||
|
Loading…
x
Reference in New Issue
Block a user