diff --git a/engine/src/RHI/D3D12/D3D12CommandList.cpp b/engine/src/RHI/D3D12/D3D12CommandList.cpp index 319c6027..71d7f0ad 100644 --- a/engine/src/RHI/D3D12/D3D12CommandList.cpp +++ b/engine/src/RHI/D3D12/D3D12CommandList.cpp @@ -90,6 +90,7 @@ void D3D12CommandList::Shutdown() { void D3D12CommandList::Reset() { if (m_commandList && m_commandAllocator) { + m_commandAllocator->Reset(); m_commandList->Reset(m_commandAllocator.Get(), nullptr); } m_currentTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; diff --git a/tests/RHI/D3D12/unit/test_command_list.cpp b/tests/RHI/D3D12/unit/test_command_list.cpp index 30fd4fa3..b686634d 100644 --- a/tests/RHI/D3D12/unit/test_command_list.cpp +++ b/tests/RHI/D3D12/unit/test_command_list.cpp @@ -11,4 +11,16 @@ TEST_F(D3D12TestFixture, CommandList_Close_Basic) { TEST_F(D3D12TestFixture, CommandList_Get_Desc) { auto type = GetCommandList()->GetCommandList()->GetType(); EXPECT_EQ(type, D3D12_COMMAND_LIST_TYPE_DIRECT); -} \ No newline at end of file +} + +TEST_F(D3D12TestFixture, CommandList_Reset_AfterExecute_ReopensCommandList) { + GetCommandList()->Close(); + + void* commandLists[] = { GetCommandList() }; + GetCommandQueue()->ExecuteCommandLists(1, commandLists); + GetCommandQueue()->WaitForPreviousFrame(); + + GetCommandList()->Reset(); + + EXPECT_TRUE(SUCCEEDED(GetCommandList()->GetCommandList()->Close())); +}