d3d12: Fix gfxcommandlist leak

This commit is contained in:
vlj 2015-05-10 20:37:27 +02:00 committed by Vincent Lejeune
parent b1c3e09155
commit 2f5a6eb993
2 changed files with 6 additions and 1 deletions

View File

@ -276,7 +276,8 @@ void D3D12GSRender::ExecCMD(u32 cmd)
{
assert(cmd == NV4097_CLEAR_SURFACE);
ID3D12GraphicsCommandList *commandList;
m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocator, nullptr, IID_PPV_ARGS(&commandList));
check(m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocator, nullptr, IID_PPV_ARGS(&commandList)));
m_inflightCommandList.push_back(commandList);
D3D12_RESOURCE_BARRIER transition = {};
transition.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
@ -711,5 +712,8 @@ void D3D12GSRender::Flip()
WaitForSingleObject(gfxqueuecompletion, INFINITE);
CloseHandle(gfxqueuecompletion);
m_commandAllocator->Reset();
for (ID3D12GraphicsCommandList *gfxCommandList : m_inflightCommandList)
gfxCommandList->Release();
m_inflightCommandList.clear();
}
#endif

View File

@ -66,6 +66,7 @@ private:
ID3D12CommandQueue *m_commandQueueCopy;
ID3D12CommandQueue *m_commandQueueGraphic;
ID3D12CommandAllocator *m_commandAllocator;
std::list<ID3D12GraphicsCommandList *> m_inflightCommandList;
struct IDXGISwapChain3 *m_swapChain;
ID3D12Resource* m_backBuffer[2];