Add ability to create a mapping from RGP linear/interopId <=> eventId

This commit is contained in:
baldurk
2018-01-11 16:44:57 +00:00
parent 4b7e7f5df1
commit e7991c07eb
4 changed files with 157 additions and 0 deletions
+101
View File
@@ -799,6 +799,9 @@ void CaptureContext::CloseCapture()
if(!m_CaptureLoaded)
return;
m_RGP2Event.clear();
m_Event2RGP.clear();
m_Config.CrashReport_LastOpenedCapture = QString();
m_CaptureTemporary = false;
@@ -1080,6 +1083,104 @@ void CaptureContext::LoadNotes(const QString &data)
}
}
void CaptureContext::CreateRGPMapping(uint32_t version)
{
m_RGP2Event.clear();
m_Event2RGP.clear();
if(!m_CaptureLoaded)
return;
if(!m_StructuredFile)
{
qCritical() << "Capture not loaded correctly - no structured data";
return;
}
if(version != 0)
{
qCritical() << "Unsupported version" << version;
return;
}
QStringList eventNames;
if(m_APIProps.pipelineType == GraphicsAPI::Vulkan)
{
eventNames << lit("vkCmdDispatch") << lit("vkCmdDispatchIndirect") << lit("vkCmdDraw")
<< lit("vkCmdDrawIndexed") << lit("vkCmdDrawIndirect")
<< lit("vkCmdDrawIndexedIndirect") << lit("vkCmdClearColorImage")
<< lit("vkCmdClearDepthStencilImage") << lit("vkCmdClearAttachments")
<< lit("vkCmdPipelineBarrier") << lit("vkCmdCopyBuffer") << lit("vkCmdCopyImage")
<< lit("vkCmdBlitImage") << lit("vkCmdCopyBufferToImage")
<< lit("vkCmdCopyImageToBuffer") << lit("vkCmdUpdateBuffer")
<< lit("vkCmdFillBuffer") << lit("vkCmdResolveImage") << lit("vkCmdResetQueryPool")
<< lit("vkCmdCopyQueryPoolResults") << lit("vkCmdWaitEvents");
}
else if(m_APIProps.pipelineType == GraphicsAPI::D3D12)
{
// these names must match those in DoStringise(const D3D12Chunk &el) for the chunks
eventNames << lit("ID3D12GraphicsCommandList::Dispatch")
<< lit("ID3D12GraphicsCommandList::DrawInstanced")
<< lit("ID3D12GraphicsCommandList::DrawIndexedInstanced")
<< lit("ID3D12GraphicsCommandList::ClearDepthStencilView")
<< lit("ID3D12GraphicsCommandList::ClearRenderTargetView")
<< lit("ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat")
<< lit("ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint")
<< lit("ID3D12GraphicsCommandList::ResourceBarrier")
<< lit("ID3D12GraphicsCommandList::CopyTextureRegion")
<< lit("ID3D12GraphicsCommandList::CopyBufferRegion")
<< lit("ID3D12GraphicsCommandList::CopyResource")
<< lit("ID3D12GraphicsCommandList::CopyTiles")
<< lit("ID3D12GraphicsCommandList::ResolveSubresource")
<< lit("ID3D12GraphicsCommandList::ResolveSubresourceRegion")
<< lit("ID3D12GraphicsCommandList::DiscardResource")
<< lit("ID3D12GraphicsCommandList::ResolveQueryData")
<< lit("ID3D12GraphicsCommandList::ExecuteIndirect")
<< lit("ID3D12GraphicsCommandList::ExecuteBundle");
}
// if we don't have any event names, this API doesn't have a mapping.
if(eventNames.isEmpty())
return;
m_Event2RGP.resize(m_LastDrawcall->eventId + 1);
// linearId 0 is invalid, so map to eventId 0.
// the first real event will be linearId 1
m_RGP2Event.push_back(0);
// iterate over all draws depth-first, to enumerate events
CreateRGPMapping(eventNames, m_Drawcalls);
}
void CaptureContext::CreateRGPMapping(const QStringList &eventNames,
const rdcarray<DrawcallDescription> &drawcalls)
{
const SDFile &file = *m_StructuredFile;
for(const DrawcallDescription &draw : drawcalls)
{
for(const APIEvent &ev : draw.events)
{
if(ev.chunkIndex == 0 || ev.chunkIndex >= file.chunks.size())
continue;
const SDChunk *chunk = file.chunks[ev.chunkIndex];
if(eventNames.contains(chunk->name, Qt::CaseSensitive))
{
m_Event2RGP[ev.eventId] = (uint32_t)m_RGP2Event.size();
m_RGP2Event.push_back(ev.eventId);
}
}
// if we have children, step into them first before going to our next sibling
if(!draw.children.empty())
CreateRGPMapping(eventNames, draw.children);
}
}
rdcstr CaptureContext::GetResourceName(ResourceId id)
{
if(id == ResourceId())