diff --git a/src/gpgmm/d3d12/HeapD3D12.cpp b/src/gpgmm/d3d12/HeapD3D12.cpp index 79c1aabde..c1a9ffa9f 100644 --- a/src/gpgmm/d3d12/HeapD3D12.cpp +++ b/src/gpgmm/d3d12/HeapD3D12.cpp @@ -55,6 +55,7 @@ namespace gpgmm::d3d12 { } ReturnIfFailed(heap->SetDebugName(descriptor.DebugName)); + GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(heap.get(), descriptor); if (heapOut != nullptr) { *heapOut = heap.release(); diff --git a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp index 0ca3432d0..dc2952e12 100644 --- a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp +++ b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp @@ -136,9 +136,6 @@ namespace gpgmm::d3d12 { // static JSONDict JSONSerializer::Serialize(const CREATE_HEAP_DESC& desc) { JSONDict dict; - if (!desc.HeapDescriptor.DebugName.empty()) { - dict.AddItem("DebugName", desc.HeapDescriptor.DebugName); - } ComPtr heap; if (SUCCEEDED(desc.Pageable->QueryInterface(IID_PPV_ARGS(&heap)))) { @@ -163,6 +160,18 @@ namespace gpgmm::d3d12 { return dict; } + // static + JSONDict JSONSerializer::Serialize(const HEAP_DESC& desc) { + JSONDict dict; + dict.AddItem("SizeInBytes", desc.SizeInBytes); + dict.AddItem("Alignment", desc.Alignment); + dict.AddItem("HeapType", desc.HeapType); + dict.AddItem("AlwaysInBudget", desc.AlwaysInBudget); + dict.AddItem("IsExternal", desc.IsExternal); + dict.AddItem("DebugName", desc.DebugName); + return dict; + } + // static JSONDict JSONSerializer::Serialize(const HEAP_INFO& info) { JSONDict dict; diff --git a/src/gpgmm/d3d12/JSONSerializerD3D12.h b/src/gpgmm/d3d12/JSONSerializerD3D12.h index aa8630b84..a64f3fc05 100644 --- a/src/gpgmm/d3d12/JSONSerializerD3D12.h +++ b/src/gpgmm/d3d12/JSONSerializerD3D12.h @@ -60,6 +60,7 @@ namespace gpgmm::d3d12 { static JSONDict Serialize(const ALLOCATION_DESC& desc); static JSONDict Serialize(const D3D12_RESOURCE_DESC& desc); static JSONDict Serialize(const CREATE_HEAP_DESC& desc); + static JSONDict Serialize(const HEAP_DESC& desc); static JSONDict Serialize(const HEAP_INFO& info); static JSONDict Serialize(const RESOURCE_ALLOCATION_DESC& desc); static JSONDict Serialize(const RESOURCE_ALLOCATION_INFO& info); diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index cf04d071e..50b6ef21a 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -200,9 +200,9 @@ namespace gpgmm::d3d12 { } } - if (residencyManager != nullptr) { - GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(residencyManager.get(), descriptor); + GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(residencyManager.get(), descriptor); + if (ppResidencyManagerOut != nullptr) { *ppResidencyManagerOut = residencyManager.release(); } diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 9bf9cf52b..6e5371f59 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -373,10 +373,11 @@ namespace gpgmm::d3d12 { "ALLOCATOR_FLAG_ALWAYS_IN_BUDGET."; } + GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(*ppResourceAllocatorOut, newDescriptor); + if (ppResourceAllocatorOut != nullptr) { *ppResourceAllocatorOut = new ResourceAllocator(newDescriptor, pResidencyManager, std::move(caps)); - GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(*ppResourceAllocatorOut, newDescriptor); } return S_OK;