mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +00:00
D3D12: Enable better live object reporting and cleanup resources on device destruction
This commit is contained in:
@@ -197,12 +197,17 @@ if (NXT_ENABLE_D3D12)
|
||||
find_library(DXGI_LIBRARY NAMES dxgi.lib HINTS ${WIN10_SDK_LIB_PATH})
|
||||
find_library(D3DCOMPILER_LIBRARY NAMES d3dcompiler.lib HINTS ${WIN10_SDK_LIB_PATH})
|
||||
|
||||
set(D3D12_LIBRARIES
|
||||
list(APPEND D3D12_LIBRARIES
|
||||
${D3D12_LIBRARY}
|
||||
${DXGI_LIBRARY}
|
||||
${D3DCOMPILER_LIBRARY}
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
find_library(DXGUID_LIBRARY NAMES dxguid.lib HINTS ${WIN10_SDK_LIB_PATH})
|
||||
list(APPEND D3D12_LIBRARIES ${DXGUID_LIBRARY})
|
||||
endif()
|
||||
|
||||
target_link_libraries(d3d12_autogen glfw nxtcpp ${D3D12_LIBRARIES})
|
||||
target_include_directories(d3d12_autogen SYSTEM PRIVATE ${D3D12_INCLUDE_DIR} ${DXGI_INCLUDE_DIR})
|
||||
target_include_directories(d3d12_autogen PRIVATE ${SRC_DIR})
|
||||
|
||||
@@ -104,10 +104,15 @@ namespace d3d12 {
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
// Wait for all in-flight commands to finish exeuting
|
||||
const uint64_t currentSerial = GetSerial();
|
||||
NextSerial();
|
||||
WaitForSerial(currentSerial);
|
||||
WaitForSerial(currentSerial); // Wait for all in-flight commands to finish executing
|
||||
TickImpl(); // Call tick one last time so resources are cleaned up
|
||||
delete commandAllocatorManager;
|
||||
delete descriptorHeapAllocator;
|
||||
delete mapReadRequestTracker;
|
||||
delete resourceAllocator;
|
||||
delete resourceUploader;
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> Device::GetD3D12Device() {
|
||||
|
||||
Reference in New Issue
Block a user