diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index d64e367cd..3de5711a6 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -402,7 +402,13 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat if(IsCaptureMode(m_State)) { - bool firstTime = false; + // If this is the creation reset we won't have our init params yet and this reset is 'fake' to + // record the initial allocator and state. Don't actually call Reset(), just pretend it was so + // that we can pretend D3D12 doesn't have weird behaviour. + bool resetcall = true; + + if(m_Init.riid.Data1 == 0 && m_Init.riid.Data2 == 0 && m_Init.riid.Data3 == 0) + resetcall = false; m_ListRecord->DisableChunkLocking(); @@ -410,14 +416,11 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat m_ListRecord->DeleteChunks(); m_ListRecord->ContainsExecuteIndirect = false; - // free any baked commands. If we don't have any, this is the creation reset - // so we don't actually do the 'real' reset. + // free any baked commands. if(m_ListRecord->bakedCommands) m_ListRecord->bakedCommands->Delete(GetResourceManager()); - else - firstTime = true; - if(!firstTime) + if(resetcall) { SERIALISE_TIME_CALL(ret = m_pList->Reset(Unwrap(pAllocator), Unwrap(pInitialState))); } @@ -446,9 +449,6 @@ HRESULT WrappedID3D12GraphicsCommandList::Reset(ID3D12CommandAllocator *pAllocat m_ListRecord->MarkResourceFrameReferenced(GetResID(pAllocator), eFrameRef_Read); if(pInitialState) m_ListRecord->MarkResourceFrameReferenced(GetResID(pInitialState), eFrameRef_Read); - - if(firstTime) - return S_OK; } else { diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp index de6926aab..1967a39db 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap.cpp @@ -341,8 +341,8 @@ HRESULT WrappedID3D12Device::CreateCommandList(UINT nodeMask, D3D12_COMMAND_LIST if(IsCaptureMode(m_State)) { // we just serialise out command allocator creation as a reset, since it's equivalent. - wrapped->SetInitParams(riid, nodeMask, type); wrapped->Reset(pCommandAllocator, pInitialState); + wrapped->SetInitParams(riid, nodeMask, type); { CACHE_THREAD_SERIALISER(); diff --git a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp index 95e54619c..6b023fe6e 100644 --- a/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp +++ b/renderdoc/driver/d3d12/d3d12_device_wrap4.cpp @@ -125,7 +125,6 @@ HRESULT WrappedID3D12Device::CreateCommandList1(UINT nodeMask, D3D12_COMMAND_LIS if(IsCaptureMode(m_State)) { - // we just serialise out command allocator creation as a reset, since it's equivalent. wrapped->SetInitParams(riid, nodeMask, type); // no flags currently RDCASSERT(flags == D3D12_COMMAND_LIST_FLAG_NONE);