mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 15:06:32 +00:00
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:
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user