diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 11289a07c..86eb14305 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -36,8 +36,7 @@ RDOC_CONFIG(bool, D3D12_DXILShaderDebugger_Logging, false, RDOC_CONFIG(bool, D3D12_DXILShaderDebugger_EnableMT, true, "Use multiple threads to run the shader debugger simulation."); -RDOC_DEBUG_CONFIG(bool, D3D12_Hack_ShaderDebugUsesJobSystemJobs, false, - "Use individual job system jobs to run shader debugging simulation."); +RDOC_EXTERN_CONFIG(bool, Shader_Debug_UseJobSystemJobs); #if ENABLED(RDOC_RELEASE) #define CHECK_DEBUGGER_THREAD() \ @@ -9990,7 +9989,7 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, uint32_t eve AtomicStore(&atomic_simulationFinished, 0); if(m_MTSimulation) { - if(!D3D12_Hack_ShaderDebugUsesJobSystemJobs()) + if(!Shader_Debug_UseJobSystemJobs()) { uint32_t countJobs = RDCMIN(threadsInWorkgroup, Threading::JobSystem::GetCountWorkers() / 2U); for(uint32_t i = 0; i < countJobs; ++i) @@ -10656,7 +10655,7 @@ void Debugger::QueueJob(uint32_t lane) thread.SetStepQueued(); if(m_MTSimulation) { - if(D3D12_Hack_ShaderDebugUsesJobSystemJobs()) + if(Shader_Debug_UseJobSystemJobs()) { Threading::JobSystem::AddJob( [this, lane]() { StepThread(lane, StepThreadMode::RUN_MULTIPLE_STEPS); }); diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.h b/renderdoc/driver/shaders/spirv/spirv_debug.h index 733926dda..5e5bad6da 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.h +++ b/renderdoc/driver/shaders/spirv/spirv_debug.h @@ -109,6 +109,7 @@ public: virtual ~DebugAPIWrapper() {} virtual void AddDebugMessage(MessageCategory c, MessageSeverity sv, MessageSource src, rdcstr d) = 0; + virtual bool SimulateThreaded() = 0; virtual ResourceId GetShaderID() = 0; virtual uint64_t GetBufferLength(const ShaderBindIndex &bind) = 0; diff --git a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp index 1e867c221..011b7993f 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug_setup.cpp @@ -30,13 +30,10 @@ #include "spirv_op_helpers.h" #include "spirv_reflect.h" -RDOC_CONFIG(bool, Vulkan_Debug_UseDebugColumnInformation, false, +RDOC_CONFIG(bool, Shader_Debug_SPIRVUseDebugColumnInformation, false, "Control whether column information should be read from vulkan debug info."); -RDOC_CONFIG(bool, Vulkan_Debug_EnableShaderDebugMT, true, - "Use multiple threads to run the shader debugger simulation."); - -RDOC_DEBUG_CONFIG(bool, Vulkan_Hack_ShaderDebugUsesJobSystemJobs, false, +RDOC_DEBUG_CONFIG(bool, Shader_Debug_UseJobSystemJobs, false, "Use individual job system jobs to run shader debugging simulation."); using namespace rdcshaders; @@ -1823,14 +1820,14 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *api, const ShaderStage s ret->samplers = global.samplers; ret->inputs = active.inputs; - mtSimulation = Vulkan_Debug_EnableShaderDebugMT(); + mtSimulation = apiWrapper->SimulateThreaded(); if(threadsInWorkgroup < 4) mtSimulation = false; AtomicStore(&atomic_simulationFinished, 0); if(mtSimulation) { - if(!Vulkan_Hack_ShaderDebugUsesJobSystemJobs()) + if(!Shader_Debug_UseJobSystemJobs()) { uint32_t countJobs = RDCMIN(threadsInWorkgroup, Threading::JobSystem::GetCountWorkers() / 2U); for(uint32_t i = 0; i < countJobs; ++i) @@ -4453,7 +4450,7 @@ void Debugger::RegisterOp(Iter it) { m_CurLineCol.lineStart = EvaluateConstant(dbg.arg(1), {}).value.u32v[0]; m_CurLineCol.lineEnd = EvaluateConstant(dbg.arg(2), {}).value.u32v[0]; - if(Vulkan_Debug_UseDebugColumnInformation()) + if(Shader_Debug_SPIRVUseDebugColumnInformation()) { m_CurLineCol.colStart = EvaluateConstant(dbg.arg(3), {}).value.u32v[0]; m_CurLineCol.colEnd = EvaluateConstant(dbg.arg(4), {}).value.u32v[0]; @@ -5012,7 +5009,7 @@ void Debugger::QueueJob(uint32_t lane) thread.SetStepQueued(); if(mtSimulation) { - if(Vulkan_Hack_ShaderDebugUsesJobSystemJobs()) + if(Shader_Debug_UseJobSystemJobs()) { Threading::JobSystem::AddJob( [this, lane]() { StepThread(lane, StepThreadMode::RUN_MULTIPLE_STEPS); }); diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index b63169c98..a4a8e4835 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -40,6 +40,9 @@ RDOC_CONFIG(rdcstr, Vulkan_Debug_PSDebugDumpDirPath, "", RDOC_CONFIG(bool, Vulkan_Debug_ShaderDebugLogging, false, "Output verbose debug logging messages when debugging shaders."); +RDOC_CONFIG(bool, Vulkan_Debug_EnableShaderDebugMT, true, + "Use multiple threads to run the shader debugger simulation."); + // needed for old linux compilers namespace std { @@ -292,6 +295,8 @@ public: m_pDriver->AddDebugMessage(cat, sev, src, desc); } + virtual bool SimulateThreaded() override { return Vulkan_Debug_EnableShaderDebugMT(); } + virtual ResourceId GetShaderID() override { return m_ShaderID; } virtual uint64_t GetBufferLength(const ShaderBindIndex &bind) override