mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Fetch dispatch thread dimension always even if we don't disassemble
* We need the dispatch thread dimension to be valid when creating the shader reflection data, which may happen before we've disassembled the bytecode. * We do a minimal pass just to skip to that opcode and extract the dims.
This commit is contained in:
@@ -294,6 +294,47 @@ void DXBCFile::FetchTypeVersion()
|
||||
m_Version.Minor = VersionToken::MinorVersion.Get(cur[0]);
|
||||
}
|
||||
|
||||
void DXBCFile::FetchThreadDim()
|
||||
{
|
||||
if(m_HexDump.empty())
|
||||
return;
|
||||
|
||||
uint32_t *begin = &m_HexDump.front();
|
||||
uint32_t *cur = begin;
|
||||
uint32_t *end = &m_HexDump.back();
|
||||
|
||||
// skip header dword above
|
||||
cur++;
|
||||
|
||||
// skip length dword
|
||||
cur++;
|
||||
|
||||
while(cur < end)
|
||||
{
|
||||
uint32_t OpcodeToken0 = cur[0];
|
||||
|
||||
OpcodeType op = Opcode::Type.Get(OpcodeToken0);
|
||||
|
||||
if(op == OPCODE_DCL_THREAD_GROUP)
|
||||
{
|
||||
DispatchThreadsDimension[0] = cur[1];
|
||||
DispatchThreadsDimension[1] = cur[2];
|
||||
DispatchThreadsDimension[2] = cur[3];
|
||||
break;
|
||||
}
|
||||
|
||||
if(op == OPCODE_CUSTOMDATA)
|
||||
{
|
||||
// length in opcode token is 0, full length is in second dword
|
||||
cur += cur[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
cur += Opcode::Length.Get(OpcodeToken0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DXBCFile::DisassembleHexDump()
|
||||
{
|
||||
if(m_Disassembled)
|
||||
|
||||
@@ -847,6 +847,12 @@ 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]);
|
||||
|
||||
@@ -405,6 +405,7 @@ private:
|
||||
DXBCFile(const DXBCFile &o);
|
||||
DXBCFile &operator=(const DXBCFile &o);
|
||||
|
||||
void FetchThreadDim();
|
||||
void FetchTypeVersion();
|
||||
void DisassembleHexDump();
|
||||
void MakeDisassemblyString();
|
||||
|
||||
Reference in New Issue
Block a user