Connect Vk and DXBC Shader Debug files to dependent files Core API

Add any found external shader debug file as a tracked dependency.
If external shader file is not found on disk, try to find it in the loaded tracked file data.
Use the shader debug filename reference as the dependency nickname : this might be an absolute path, relative path or a hash.
This commit is contained in:
Jake Turner
2025-12-11 10:18:34 +13:00
parent 5db4350193
commit 0bd07bf283
2 changed files with 33 additions and 10 deletions
@@ -125,7 +125,10 @@ struct DebugFile
void ReadAndProcess(bool lz4, const rdcfixedarray<uint32_t, 4> &desiredHash)
{
FileIO::ReadAll(path, contents);
Process(lz4, desiredHash);
}
void Process(bool lz4, const rdcfixedarray<uint32_t, 4> &desiredHash)
{
if(lz4)
{
bytebuf decompressed;
@@ -1517,6 +1520,7 @@ void DXBCContainer::TryFetchSeparateDebugInfo(bytebuf &byteCode, const rdcstr &d
DebugFile found;
rdcstr nickname = originalPath;
// keep searching until we've exhausted all possible path options, or we've found a file that
// opens and (optionally if we have it matches the hash we're looking for)
rdcstr tempPath = originalPath;
@@ -1609,12 +1613,24 @@ void DXBCContainer::TryFetchSeparateDebugInfo(bytebuf &byteCode, const rdcstr &d
}
}
// Try to retrieve debug file from the externally referenced files in the capture
if(found.empty())
{
if(RenderDoc::Inst().GetTrackedFileData(nickname, found.contents))
{
found.path = nickname;
found.Process(lz4, desiredHash);
}
}
if(found.empty())
{
RDCDEBUG("Couldn't find pdb for %s", originalPath.c_str());
return;
}
RenderDoc::Inst().AddTrackedFileReference(nickname, found.path);
if(found.pdb)
{
m_DebugShaderBlob = found.contents;
+16 -9
View File
@@ -2762,6 +2762,7 @@ void VulkanCreationInfo::ShaderModule::Reinit()
size_t numSearchPaths = searchPaths.size();
rdcstr foundFname = originalPath;
rdcstr foundPath;
// keep searching until we've exhausted all possible path options, or we've found a file that
@@ -2804,19 +2805,26 @@ void VulkanCreationInfo::ShaderModule::Reinit()
}
}
// Try to retrieve debug file from the externally referenced files in the capture
bytebuf debugBytecode;
if(originalShaderFile == NULL)
return;
FileIO::fseek64(originalShaderFile, 0L, SEEK_END);
uint64_t originalShaderSize = FileIO::ftell64(originalShaderFile);
FileIO::fseek64(originalShaderFile, 0, SEEK_SET);
{
bytebuf debugBytecode;
if(!RenderDoc::Inst().GetTrackedFileData(foundFname, debugBytecode))
return;
}
else
{
FileIO::fseek64(originalShaderFile, 0L, SEEK_END);
uint64_t originalShaderSize = FileIO::ftell64(originalShaderFile);
FileIO::fseek64(originalShaderFile, 0, SEEK_SET);
debugBytecode.resize((size_t)originalShaderSize);
FileIO::fread(&debugBytecode[0], sizeof(byte), (size_t)originalShaderSize, originalShaderFile);
FileIO::fclose(originalShaderFile);
originalShaderFile = NULL;
}
{
if(lz4)
{
rdcarray<byte> decompressed;
@@ -2858,10 +2866,9 @@ void VulkanCreationInfo::ShaderModule::Reinit()
if(!reflTest.GetSPIRV().empty())
{
spirv = reflTest;
RenderDoc::Inst().AddTrackedFileReference(foundFname, foundPath);
}
}
FileIO::fclose(originalShaderFile);
}
void VulkanCreationInfo::ShaderModuleReflection::Init(VulkanResourceManager *resourceMan,