mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Fetch computer shader thread/group declared inputs to input signature
* This helps match up inputs for shader debugging when high-level variables have to match up to a particular fixed input.
This commit is contained in:
@@ -294,7 +294,7 @@ void DXBCFile::FetchTypeVersion()
|
||||
m_Version.Minor = VersionToken::MinorVersion.Get(cur[0]);
|
||||
}
|
||||
|
||||
void DXBCFile::FetchThreadDim()
|
||||
void DXBCFile::FetchComputeProperties()
|
||||
{
|
||||
if(m_HexDump.empty())
|
||||
return;
|
||||
@@ -320,7 +320,47 @@ void DXBCFile::FetchThreadDim()
|
||||
DispatchThreadsDimension[0] = cur[1];
|
||||
DispatchThreadsDimension[1] = cur[2];
|
||||
DispatchThreadsDimension[2] = cur[3];
|
||||
break;
|
||||
}
|
||||
else if(op == OPCODE_DCL_INPUT)
|
||||
{
|
||||
OperandType type = Operand::Type.Get(cur[1]);
|
||||
|
||||
SigParameter param;
|
||||
|
||||
param.compType = CompType::UInt;
|
||||
param.regIndex = ~0U;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_INPUT_THREAD_ID:
|
||||
param.systemValue = ShaderBuiltin::DispatchThreadIndex;
|
||||
param.compCount = 3;
|
||||
param.regChannelMask = param.channelUsedMask = 0x7;
|
||||
param.semanticIdxName = param.semanticName = "vThreadID";
|
||||
m_InputSig.push_back(param);
|
||||
break;
|
||||
case TYPE_INPUT_THREAD_GROUP_ID:
|
||||
param.systemValue = ShaderBuiltin::GroupIndex;
|
||||
param.compCount = 3;
|
||||
param.regChannelMask = param.channelUsedMask = 0x7;
|
||||
param.semanticIdxName = param.semanticName = "vThreadGroupID";
|
||||
m_InputSig.push_back(param);
|
||||
break;
|
||||
case TYPE_INPUT_THREAD_ID_IN_GROUP:
|
||||
param.systemValue = ShaderBuiltin::GroupThreadIndex;
|
||||
param.compCount = 3;
|
||||
param.regChannelMask = param.channelUsedMask = 0x7;
|
||||
param.semanticIdxName = param.semanticName = "vThreadIDInGroup";
|
||||
m_InputSig.push_back(param);
|
||||
break;
|
||||
case TYPE_INPUT_THREAD_ID_IN_GROUP_FLATTENED:
|
||||
param.systemValue = ShaderBuiltin::GroupFlatIndex;
|
||||
param.compCount = 1;
|
||||
param.regChannelMask = param.channelUsedMask = 0x1;
|
||||
param.semanticIdxName = param.semanticName = "vThreadIDInGroupFlattened";
|
||||
m_InputSig.push_back(param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(op == OPCODE_CUSTOMDATA)
|
||||
|
||||
@@ -883,12 +883,6 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength)
|
||||
m_GuessedResources = true;
|
||||
}
|
||||
|
||||
// make sure to fetch the dispatch threads dimension from disassembly
|
||||
if(!m_Disassembled && m_Type == D3D11_ShaderType_Compute)
|
||||
{
|
||||
FetchThreadDim();
|
||||
}
|
||||
|
||||
for(uint32_t chunkIdx = 0; chunkIdx < header->numChunks; chunkIdx++)
|
||||
{
|
||||
uint32_t *fourcc = (uint32_t *)(data + chunkOffsets[chunkIdx]);
|
||||
@@ -1067,6 +1061,12 @@ DXBCFile::DXBCFile(const void *ByteCode, size_t ByteCodeLength)
|
||||
}
|
||||
}
|
||||
|
||||
// make sure to fetch the dispatch threads dimension from disassembly
|
||||
if(!m_Disassembled && m_Type == D3D11_ShaderType_Compute)
|
||||
{
|
||||
FetchComputeProperties();
|
||||
}
|
||||
|
||||
// initialise debug chunks last
|
||||
for(uint32_t chunkIdx = 0; chunkIdx < header->numChunks; chunkIdx++)
|
||||
{
|
||||
|
||||
@@ -403,7 +403,7 @@ private:
|
||||
DXBCFile(const DXBCFile &o);
|
||||
DXBCFile &operator=(const DXBCFile &o);
|
||||
|
||||
void FetchThreadDim();
|
||||
void FetchComputeProperties();
|
||||
void FetchTypeVersion();
|
||||
void DisassembleHexDump();
|
||||
void MakeDisassemblyString();
|
||||
|
||||
Reference in New Issue
Block a user