Don't reset chunk allocator mid-capture

* We may still need these chunks for previously submitted frames if we're saving
  everything in a capture.
This commit is contained in:
baldurk
2020-09-07 11:56:24 +01:00
parent b522224572
commit 9b46bf7c91
4 changed files with 16 additions and 2 deletions
+1
View File
@@ -341,6 +341,7 @@ D3D12DebugManager::D3D12DebugManager(WrappedID3D12Device *wrapper)
hr = m_pDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
__uuidof(ID3D12CommandAllocator), (void **)&m_DebugAlloc);
((WrappedID3D12CommandAllocator *)m_DebugAlloc)->SetInternal(true);
m_pDevice->InternalRef();
if(FAILED(hr))
+2
View File
@@ -2798,6 +2798,7 @@ void WrappedID3D12Device::CreateInternalResources()
CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator),
(void **)&m_Alloc);
((WrappedID3D12CommandAllocator *)m_Alloc)->SetInternal(true);
InternalRef();
CreateFence(0, D3D12_FENCE_FLAG_NONE, __uuidof(ID3D12Fence), (void **)&m_GPUSyncFence);
InternalRef();
@@ -2808,6 +2809,7 @@ void WrappedID3D12Device::CreateInternalResources()
CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator),
(void **)&m_DataUploadAlloc);
((WrappedID3D12CommandAllocator *)m_DataUploadAlloc)->SetInternal(true);
InternalRef();
GetResourceManager()->SetInternalResource(m_DataUploadAlloc);
+8 -1
View File
@@ -359,6 +359,7 @@ public:
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12CommandAllocator, AllocPoolCount, AllocMaxByteSize);
ChunkAllocator alloc;
bool m_Internal = false;
enum
{
@@ -370,12 +371,18 @@ public:
{
}
virtual ~WrappedID3D12CommandAllocator() { Shutdown(); }
void SetInternal(bool internalAlloc) { m_Internal = internalAlloc; }
//////////////////////////////
// implement ID3D12CommandAllocator
virtual HRESULT STDMETHODCALLTYPE Reset()
{
alloc.Reset();
if(!m_Internal)
m_pDevice->GetCapTransitionLock().ReadLock();
if(IsBackgroundCapturing(m_pDevice->GetState()))
alloc.Reset();
if(!m_Internal)
m_pDevice->GetCapTransitionLock().ReadUnlock();
return m_pReal->Reset();
}
};
@@ -546,7 +546,11 @@ VkResult WrappedVulkan::vkCreateCommandPool(VkDevice device,
VkResult WrappedVulkan::vkResetCommandPool(VkDevice device, VkCommandPool cmdPool,
VkCommandPoolResetFlags flags)
{
GetRecord(cmdPool)->cmdPoolInfo->alloc.Reset();
{
SCOPED_READLOCK(m_CapTransitionLock);
if(IsBackgroundCapturing(m_State))
GetRecord(cmdPool)->cmdPoolInfo->alloc.Reset();
}
return ObjDisp(device)->ResetCommandPool(Unwrap(device), Unwrap(cmdPool), flags);
}