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:
baldurk
2018-10-08 17:45:09 +01:00
parent 615b743b8e
commit 1dd4eb4410
3 changed files with 49 additions and 9 deletions
@@ -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++)
{
+1 -1
View File
@@ -403,7 +403,7 @@ private:
DXBCFile(const DXBCFile &o);
DXBCFile &operator=(const DXBCFile &o);
void FetchThreadDim();
void FetchComputeProperties();
void FetchTypeVersion();
void DisassembleHexDump();
void MakeDisassemblyString();