From b2c9ed0b4ba1d15a582a1c2be99697be0d216f7c Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 30 Jul 2016 16:53:50 +0700 Subject: [PATCH] Make sure not to reset newly created command lists - it's invalid --- renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index ebbef2d9e..35ba8c26f 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -261,15 +261,20 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat { if(m_State >= WRITING) { + bool firstTime = false; + // reset for new recording m_ListRecord->DeleteChunks(); // free parents m_ListRecord->FreeParents(GetResourceManager()); - // free any baked commands + // free any baked commands. If we don't have any, this is the creation reset + // so we return before actually doing the 'real' reset. if(m_ListRecord->bakedCommands) m_ListRecord->bakedCommands->Delete(GetResourceManager()); + else + firstTime = true; m_ListRecord->bakedCommands = GetResourceManager()->AddResourceRecord(ResourceIDGen::GetNewUniqueID()); @@ -288,6 +293,9 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat m_ListRecord->AddParent(GetRecord(pAllocator)); if(pInitialState) m_ListRecord->AddParent(GetRecord(pInitialState)); + + if(firstTime) + return S_OK; } return m_pReal->Reset(Unwrap(pAllocator), Unwrap(pInitialState));