diff --git a/renderdoc/driver/shaders/dxil/dxil_controlflow.cpp b/renderdoc/driver/shaders/dxil/dxil_controlflow.cpp index 0ab08c7a0..c31270626 100644 --- a/renderdoc/driver/shaders/dxil/dxil_controlflow.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_controlflow.cpp @@ -25,8 +25,12 @@ #include #include +#include "common/formatting.h" +#include "core/settings.h" #include "dxil_controlflow.h" +RDOC_EXTERN_CONFIG(bool, D3D12_DXILShaderDebugger_Logging); + /* Inputs are links of blocks : from -> to (can be forwards or backwards links) @@ -327,6 +331,73 @@ void ControlFlow::FindUniformBlocks(rdcarray &uniformBlocks) if(!loopBlocks.contains(block)) uniformBlocks.push_back(block); } + + if(D3D12_DXILShaderDebugger_Logging()) + { + RDCLOG("Block Links:"); + for(auto it = m_BlockLinks.begin(); it != m_BlockLinks.end(); ++it) + { + uint32_t from = it->first; + for(uint32_t to : it->second) + RDCLOG("Block:%d->Block:%d", from, to); + } + + RDCLOG("Thread Paths:"); + rdcstr output = ""; + for(uint32_t pathIdx = 0; pathIdx < m_Paths.size(); ++pathIdx) + { + bool start = true; + for(uint32_t block : m_Paths[pathIdx]) + { + if(start) + { + output = StringFormat::Fmt("%d : %d", pathIdx, block); + start = false; + } + else + { + if(block != PATH_END) + output += " -> " + ToStr(block); + else + output += " : END"; + } + } + RDCLOG(output.c_str()); + } + + output = ""; + bool needComma = false; + for(uint32_t block : loopBlocks) + { + if(needComma) + output += ", "; + output += ToStr(block); + needComma = true; + } + RDCLOG("Blocks in Loops: %s", output.c_str()); + + output = ""; + needComma = false; + for(uint32_t block : allPathsBlocks) + { + if(needComma) + output += ", "; + output += ToStr(block); + needComma = true; + } + RDCLOG("Blocks in All-Paths: %s", output.c_str()); + + output = ""; + needComma = false; + for(uint32_t block : uniformBlocks) + { + if(needComma) + output += ", "; + output += ToStr(block); + needComma = true; + } + RDCLOG("Uniform Blocks: %s", output.c_str()); + } } void FindUniformBlocks(const rdcarray &links, rdcarray &uniformBlocks) diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 19c734f96..5c2d67028 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -24,10 +24,14 @@ #include "dxil_debug.h" #include "common/formatting.h" +#include "core/settings.h" #include "maths/formatpacking.h" #include "replay/common/var_dispatch_helpers.h" #include "dxil_controlflow.h" +RDOC_CONFIG(bool, D3D12_DXILShaderDebugger_Logging, false, + "Debug logging for the DXIL shader debugger"); + // normal is not zero, not subnormal, not infinite, not NaN inline bool RDCISNORMAL(float input) {