Build shaders with debug info when self-capturing

This commit is contained in:
baldurk
2025-09-19 11:05:44 +01:00
parent fd86ca4ddc
commit b857cb2b0b
2 changed files with 27 additions and 0 deletions
@@ -118,7 +118,11 @@ rdcstr rdcspv::Compile(const rdcspv::CompilationSettings &settings, const rdcarr
glslang::SpvOptions opts;
if(settings.debugInfo)
{
opts.generateDebugInfo = true;
opts.emitNonSemanticShaderDebugInfo = true;
opts.emitNonSemanticShaderDebugSource = true;
}
std::vector<uint32_t> spirvVec;
glslang::GlslangToSpv(*intermediate, spirvVec, &opts);
@@ -274,6 +274,26 @@ VulkanShaderCache::VulkanShaderCache(WrappedVulkan *driver)
rdcspv::CompilationSettings compileSettings;
compileSettings.lang = rdcspv::InputLanguage::VulkanGLSL;
uint32_t toolCount = 0;
if(ObjDisp(driver->GetPhysDev())->GetPhysicalDeviceToolProperties != NULL)
{
ObjDisp(driver->GetPhysDev())
->GetPhysicalDeviceToolProperties(Unwrap(driver->GetPhysDev()), &toolCount, NULL);
rdcarray<VkPhysicalDeviceToolProperties> tools;
tools.resize(toolCount);
ObjDisp(driver->GetPhysDev())
->GetPhysicalDeviceToolProperties(Unwrap(driver->GetPhysDev()), &toolCount, tools.data());
for(const VkPhysicalDeviceToolProperties &t : tools)
{
if(rdcstr(t.name) == "RenderDoc")
{
RDCLOG("Enabling debug info for self-captured shaders");
compileSettings.debugInfo = true;
}
}
}
m_Buffer2MSSupported = PassesChecks(builtinShaders[(size_t)BuiltinShader::Buffer2MSCS], driver,
driverVersion, availFeatures);
@@ -325,6 +345,9 @@ VulkanShaderCache::VulkanShaderCache(WrappedVulkan *driver)
// source & defines.
inputHash = strhash("inputHashVersion1", inputHash);
if(compileSettings.debugInfo)
inputHash = strhash("debug", inputHash);
rdcstr err;
if(m_ShaderCache.find(inputHash) != m_ShaderCache.end())