diff --git a/renderdoc/driver/shaders/spirv/spirv_compile.cpp b/renderdoc/driver/shaders/spirv/spirv_compile.cpp index 04b6d626c..238727842 100644 --- a/renderdoc/driver/shaders/spirv/spirv_compile.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_compile.cpp @@ -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 spirvVec; glslang::GlslangToSpv(*intermediate, spirvVec, &opts); diff --git a/renderdoc/driver/vulkan/vk_shader_cache.cpp b/renderdoc/driver/vulkan/vk_shader_cache.cpp index 6b635d244..d51ffc400 100644 --- a/renderdoc/driver/vulkan/vk_shader_cache.cpp +++ b/renderdoc/driver/vulkan/vk_shader_cache.cpp @@ -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 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())