mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-31 20:01:12 +00:00
Make a cracked allocator per real allocator, for threaded recording
* Threaded recording means the recording chunks are all interleaved in the log so we may be cracking multiple command lists at the same time and so need multiple allocators. Since the original capture obeyed the rule of only recording to one list from an allocator at once, making a cracked allocator for each also obeys that rule.
This commit is contained in:
@@ -254,15 +254,16 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(ID3D12CommandAllocator *p
|
||||
m_Cmd->m_BakedCmdListInfo[CommandList].draw = draw;
|
||||
|
||||
{
|
||||
if(m_Cmd->m_CrackedAllocators[type] == NULL)
|
||||
if(m_Cmd->m_CrackedAllocators[Allocator] == NULL)
|
||||
{
|
||||
HRESULT hr = m_pDevice->CreateCommandAllocator(
|
||||
type, __uuidof(ID3D12CommandAllocator), (void **)&m_Cmd->m_CrackedAllocators[type]);
|
||||
HRESULT hr =
|
||||
m_pDevice->CreateCommandAllocator(type, __uuidof(ID3D12CommandAllocator),
|
||||
(void **)&m_Cmd->m_CrackedAllocators[Allocator]);
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
}
|
||||
|
||||
ID3D12GraphicsCommandList *list = NULL;
|
||||
m_pDevice->CreateCommandList(nodeMask, type, m_Cmd->m_CrackedAllocators[type],
|
||||
m_pDevice->CreateCommandList(nodeMask, type, m_Cmd->m_CrackedAllocators[Allocator],
|
||||
pInitialState, riid, (void **)&list);
|
||||
|
||||
RDCASSERT(m_Cmd->m_BakedCmdListInfo[CommandList].crackedLists.empty());
|
||||
@@ -271,6 +272,7 @@ bool WrappedID3D12GraphicsCommandList::Serialise_Reset(ID3D12CommandAllocator *p
|
||||
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].type = type;
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].nodeMask = nodeMask;
|
||||
m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].allocator = Allocator;
|
||||
|
||||
// On list execute we increment all child events/drawcalls by
|
||||
// m_RootEventID and insert them into the tree.
|
||||
@@ -3736,15 +3738,11 @@ bool WrappedID3D12GraphicsCommandList::Serialise_ExecuteIndirect(
|
||||
D3D12_COMMAND_LIST_TYPE type = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].type;
|
||||
UINT nodeMask = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].nodeMask;
|
||||
|
||||
if(m_Cmd->m_CrackedAllocators[type] == NULL)
|
||||
{
|
||||
HRESULT hr = m_pDevice->CreateCommandAllocator(type, __uuidof(ID3D12CommandAllocator),
|
||||
(void **)&m_Cmd->m_CrackedAllocators[type]);
|
||||
RDCASSERTEQUAL(hr, S_OK);
|
||||
}
|
||||
ResourceId allocid = m_Cmd->m_BakedCmdListInfo[m_Cmd->m_LastCmdListID].allocator;
|
||||
ID3D12CommandAllocator *allocator = m_Cmd->m_CrackedAllocators[allocid];
|
||||
|
||||
ID3D12GraphicsCommandList *list = NULL;
|
||||
m_pDevice->CreateCommandList(nodeMask, type, m_Cmd->m_CrackedAllocators[type], NULL,
|
||||
m_pDevice->CreateCommandList(nodeMask, type, allocator, NULL,
|
||||
__uuidof(ID3D12GraphicsCommandList), (void **)&list);
|
||||
|
||||
m_Cmd->m_BakedCmdListInfo[CommandList].crackedLists.push_back(list);
|
||||
|
||||
@@ -749,8 +749,6 @@ D3D12CommandData::D3D12CommandData()
|
||||
m_FirstEventID = 0;
|
||||
m_LastEventID = ~0U;
|
||||
|
||||
RDCEraseEl(m_CrackedAllocators);
|
||||
|
||||
m_pDevice = NULL;
|
||||
m_pSerialiser = NULL;
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ struct BakedCmdListInfo
|
||||
|
||||
vector<pair<ResourceId, EventUsage> > resourceUsage;
|
||||
|
||||
ResourceId allocator;
|
||||
D3D12_COMMAND_LIST_TYPE type;
|
||||
UINT nodeMask;
|
||||
D3D12RenderState state;
|
||||
@@ -210,7 +211,7 @@ struct D3D12CommandData
|
||||
|
||||
ResourceId m_LastCmdListID;
|
||||
|
||||
ID3D12CommandAllocator *m_CrackedAllocators[4];
|
||||
map<ResourceId, ID3D12CommandAllocator *> m_CrackedAllocators;
|
||||
|
||||
vector<ID3D12Resource *> m_IndirectBuffers;
|
||||
static const uint64_t m_IndirectSize = 4 * 1024 * 1024;
|
||||
|
||||
@@ -2069,10 +2069,8 @@ void WrappedID3D12Device::ReadLogInitialisation()
|
||||
it->second.crackedLists.clear();
|
||||
}
|
||||
|
||||
SAFE_RELEASE(cmd.m_CrackedAllocators[D3D12_COMMAND_LIST_TYPE_DIRECT]);
|
||||
SAFE_RELEASE(cmd.m_CrackedAllocators[D3D12_COMMAND_LIST_TYPE_BUNDLE]);
|
||||
SAFE_RELEASE(cmd.m_CrackedAllocators[D3D12_COMMAND_LIST_TYPE_COMPUTE]);
|
||||
SAFE_RELEASE(cmd.m_CrackedAllocators[D3D12_COMMAND_LIST_TYPE_COPY]);
|
||||
for(auto it = cmd.m_CrackedAllocators.begin(); it != cmd.m_CrackedAllocators.end(); it++)
|
||||
SAFE_RELEASE(it->second);
|
||||
}
|
||||
|
||||
#if !defined(RELEASE)
|
||||
|
||||
Reference in New Issue
Block a user