DXIL ControlFlow put debug logging behind a config option

"D3D12_DXILShaderDebugger_Logging"
This commit is contained in:
Jake Turner
2024-11-28 17:33:22 +00:00
parent 82825fdf90
commit 2c55fcac93
2 changed files with 75 additions and 0 deletions
@@ -25,8 +25,12 @@
#include <unordered_map>
#include <unordered_set>
#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<uint32_t> &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<BlockLink> &links, rdcarray<uint32_t> &uniformBlocks)
@@ -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)
{