Reset command allocators each frame, after syncing GPU

This commit is contained in:
baldurk
2018-07-16 23:38:07 +01:00
parent 5ff58a0941
commit 810a3e77a5
3 changed files with 11 additions and 0 deletions
+7
View File
@@ -2783,6 +2783,13 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID,
m_Queues[i]->Signal(m_QueueFences[i], m_GPUSyncCounter);
FlushLists(true);
// take this opportunity to reset command allocators to ensure we don't steadily leak over time.
if(m_DataUploadAlloc)
m_DataUploadAlloc->Reset();
for(ID3D12CommandAllocator *alloc : m_CommandAllocators)
alloc->Reset();
}
if(!partial)
+2
View File
@@ -250,6 +250,8 @@ private:
HANDLE m_GPUSyncHandle;
UINT64 m_GPUSyncCounter;
std::vector<ID3D12CommandAllocator *> m_CommandAllocators;
D3D12_CPU_DESCRIPTOR_HANDLE AllocRTV();
void FreeRTV(D3D12_CPU_DESCRIPTOR_HANDLE handle);
@@ -159,6 +159,8 @@ bool WrappedID3D12Device::Serialise_CreateCommandAllocator(SerialiserType &ser,
{
ret = new WrappedID3D12CommandAllocator(ret, this);
m_CommandAllocators.push_back(ret);
GetResourceManager()->AddLiveResource(pCommandAllocator, ret);
AddResource(pCommandAllocator, ResourceType::Pool, "Command Queue");