Propagate command line arguments from DebugEntryPoint

This commit is contained in:
baldurk
2022-08-10 12:21:51 +01:00
parent 8bf0c22d66
commit e29d48a2a8
2 changed files with 11 additions and 3 deletions
@@ -597,6 +597,7 @@ void Reflector::RegisterOp(Iter it)
else if(dbg.inst == ShaderDbg::EntryPoint)
{
funcToBaseFile[dbg.arg<Id>(0)] = compUnitToFileIndex[dbg.arg<Id>(1)];
funcToCmdLine[dbg.arg<Id>(0)] = strings[dbg.arg<Id>(3)];
}
else if(dbg.inst == ShaderDbg::GlobalVariable)
{
@@ -831,9 +832,6 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
reflection.dispatchThreadsDimension[2] = 0;
}
if(!cmdline.empty())
reflection.debugInfo.compileFlags.flags = {{"@cmdline", cmdline}};
for(size_t i = 0; i < sources.size(); i++)
{
switch(sources[i].lang)
@@ -866,6 +864,15 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
reflection.debugInfo.editBaseFile = (int32_t)it->second;
}
if(!cmdline.empty())
reflection.debugInfo.compileFlags.flags = {{"@cmdline", cmdline}};
{
auto it = funcToCmdLine.find(entry->id);
if(it != funcToCmdLine.end())
reflection.debugInfo.compileFlags.flags = {{"@cmdline", it->second}};
}
PreprocessLineDirectives(reflection.debugInfo.files);
// we do a mini-preprocess of the files from the debug info to handle #line directives.
@@ -131,6 +131,7 @@ private:
SparseIdMap<size_t> debugSources;
SparseIdMap<size_t> compUnitToFileIndex;
SparseIdMap<size_t> funcToBaseFile;
SparseIdMap<rdcstr> funcToCmdLine;
SparseIdMap<LineColumnInfo> debugFuncToLocation;
SparseIdMap<LineColumnInfo> funcToLocation;