Add basic serialisation of bundle execution, without stepping-in support

This commit is contained in:
baldurk
2016-10-26 23:14:14 +02:00
parent dd0a68c9c9
commit ab9ada685a
3 changed files with 82 additions and 1 deletions
@@ -2796,10 +2796,89 @@ void WrappedID3D12GraphicsCommandList::Dispatch(UINT ThreadGroupCountX, UINT Thr
}
}
bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteBundle(ID3D12GraphicsCommandList *pCommandList)
{
SERIALISE_ELEMENT(ResourceId, CommandList, GetResourceID());
ResourceId Bundle;
if(m_State >= WRITING)
{
D3D12ResourceRecord *record = GetRecord(pCommandList);
RDCASSERT(record->bakedCommands);
if(record->bakedCommands)
Bundle = record->bakedCommands->GetResourceID();
}
m_pSerialiser->Serialise("Bundle", Bundle);
if(m_State < WRITING)
m_Cmd->m_LastCmdListID = CommandList;
if(m_State == EXECUTING)
{
if(m_Cmd->ShouldRerecordCmd(CommandList) && m_Cmd->InRerecordRange(CommandList))
{
ID3D12GraphicsCommandList *list = m_Cmd->RerecordCmdList(CommandList);
uint32_t eventID = m_Cmd->HandlePreCallback(list, true);
ID3D12GraphicsCommandList *bundle =
GetResourceManager()->GetLiveAs<ID3D12GraphicsCommandList>(Bundle);
Unwrap(list)->ExecuteBundle(Unwrap(bundle));
if(eventID && m_Cmd->m_DrawcallCallback->PostDraw(eventID, list))
{
Unwrap(list)->ExecuteBundle(Unwrap(bundle));
m_Cmd->m_DrawcallCallback->PostRedraw(eventID, list);
}
}
}
else if(m_State == READING)
{
ID3D12GraphicsCommandList *bundle =
GetResourceManager()->GetLiveAs<ID3D12GraphicsCommandList>(Bundle);
GetList(CommandList)->ExecuteBundle(Unwrap(bundle));
GetCrackedList(CommandList)->ExecuteBundle(Unwrap(bundle));
const string desc = m_pSerialiser->GetDebugStr();
m_Cmd->AddEvent(desc);
string name = "ExecuteBundle(" + ToStr::Get(Bundle) + ")";
FetchDrawcall draw;
draw.name = name;
draw.flags |= eDraw_CmdList;
m_Cmd->AddDrawcall(draw, true);
}
return true;
}
void WrappedID3D12GraphicsCommandList::ExecuteBundle(ID3D12GraphicsCommandList *pCommandList)
{
D3D12NOTIMP("Bundle execution");
m_pReal->ExecuteBundle(Unwrap(pCommandList));
if(m_State >= WRITING)
{
SCOPED_SERIALISE_CONTEXT(EXEC_BUNDLE);
Serialise_ExecuteBundle(pCommandList);
m_ListRecord->AddChunk(scope.Get());
D3D12ResourceRecord *record = GetRecord(pCommandList);
CmdListRecordingInfo *dst = m_ListRecord->cmdInfo;
CmdListRecordingInfo *src = record->bakedCommands->cmdInfo;
dst->boundDescs.insert(src->boundDescs.begin(), src->boundDescs.end());
dst->dirtied.insert(src->dirtied.begin(), src->dirtied.end());
dst->bundles.push_back(record);
}
}
/*
@@ -293,6 +293,7 @@ void WrappedID3D12CommandQueue::ProcessChunk(uint64_t offset, D3D12ChunkType chu
case DRAW_INDEXED_INST: m_ReplayList->Serialise_DrawIndexedInstanced(0, 0, 0, 0, 0); break;
case DISPATCH: m_ReplayList->Serialise_Dispatch(0, 0, 0); break;
case EXEC_INDIRECT: m_ReplayList->Serialise_ExecuteIndirect(NULL, 0, NULL, 0, NULL, 0); break;
case EXEC_BUNDLE: m_ReplayList->Serialise_ExecuteBundle(NULL); break;
case COPY_BUFFER: m_ReplayList->Serialise_CopyBufferRegion(NULL, 0, NULL, 0, 0); break;
case COPY_TEXTURE: m_ReplayList->Serialise_CopyTextureRegion(NULL, 0, 0, 0, NULL, NULL); break;
+1
View File
@@ -299,6 +299,7 @@ void Serialiser::Serialise(const char *name, D3D12Descriptor &el);
D3D12_CHUNK_MACRO(DRAW_INST, "ID3D12GraphicsCommandList::DrawInstanced") \
D3D12_CHUNK_MACRO(DISPATCH, "ID3D12GraphicsCommandList::Dispatch") \
D3D12_CHUNK_MACRO(EXEC_INDIRECT, "ID3D12GraphicsCommandList::ExecuteIndirect") \
D3D12_CHUNK_MACRO(EXEC_BUNDLE, "ID3D12GraphicsCommandList::ExecuteBundle") \
\
D3D12_CHUNK_MACRO(COPY_BUFFER, "ID3D12GraphicsCommandList::CopyBufferRegion") \
D3D12_CHUNK_MACRO(COPY_TEXTURE, "ID3D12GraphicsCommandList::CopyTextureRegion") \