D3D12: Destroy all COM objects before the DLLs are unloaded

Change-Id: I00109460fa83110bd9af6d6b8ff2b5022ed580f3
This commit is contained in:
Corentin Wallez 2018-09-03 18:37:35 +02:00 committed by Corentin Wallez
parent 98ca29b582
commit eb7d64a17f
1 changed files with 9 additions and 0 deletions

View File

@ -160,6 +160,14 @@ namespace dawn_native { namespace d3d12 {
WaitForSerial(currentSerial); // Wait for all in-flight commands to finish executing
TickImpl(); // Call tick one last time so resources are cleaned up
ASSERT(mUsedComObjectRefs.Empty());
ASSERT(mPendingCommands.commandList == nullptr);
// Free all D3D12 and DXGI objects before unloading the DLLs
mFence = nullptr;
mFactory = nullptr;
mHardwareAdapter = nullptr;
mD3d12Device = nullptr;
mCommandQueue = nullptr;
delete mCommandAllocatorManager;
delete mDescriptorHeapAllocator;
@ -266,6 +274,7 @@ namespace dawn_native { namespace d3d12 {
std::copy(commandLists.begin(), commandLists.end(), lists.begin() + 1);
mCommandQueue->ExecuteCommandLists(static_cast<UINT>(commandLists.size() + 1),
lists.data());
mPendingCommands.commandList = nullptr;
} else {
std::vector<ID3D12CommandList*> lists(commandLists);
mCommandQueue->ExecuteCommandLists(static_cast<UINT>(commandLists.size()),