Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gpgmm/d3d12/DebugObjectD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
namespace gpgmm::d3d12 {

LPCWSTR DebugObject::GetDebugName() const {
if (mDebugName.empty()) {
return L"'Unknown'";
}

return mDebugName.c_str();
}

Expand Down
15 changes: 8 additions & 7 deletions src/gpgmm/d3d12/HeapD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace gpgmm::d3d12 {
CreateHeapFn createHeapFn,
void* pCreateHeapContext,
IHeap** ppHeapOut) {
ReturnIfNullptr(pCreateHeapContext);

const bool isResidencyDisabled = (pResidencyManager == nullptr);

ResidencyManager* residencyManager = static_cast<ResidencyManager*>(pResidencyManager);
Expand All @@ -94,7 +96,8 @@ namespace gpgmm::d3d12 {
}

ComPtr<ID3D12Pageable> pageable;
ReturnIfFailed(createHeapFn(pCreateHeapContext, &pageable));
ReturnIfFailedDevice(createHeapFn(pCreateHeapContext, &pageable),
GetDevice(pageable.Get()));

// Pageable-based type is required for residency-managed heaps.
ReturnIfNullptr(pageable);
Expand Down Expand Up @@ -148,16 +151,14 @@ namespace gpgmm::d3d12 {
}
}

const std::string debugName =
(heap->GetDebugName() == nullptr) ? WCharToUTF8(heap->GetDebugName()) : "'Unknown'";
ReturnIfFailed(heap->SetDebugName(descriptor.DebugName));
GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(heap.get(), descriptor);

gpgmm::DebugLog(MessageId::kMemoryAllocated)
<< "Created heap (" << debugName << "=" << ToHexStr(heap.get())
<< "Created heap (" << WCharToUTF8(heap->GetDebugName()) << "=" << ToHexStr(heap.get())
<< "), Size=" << heap->GetInfo().SizeInBytes
<< ", ID3D12Pageable=" << ToHexStr(heap->mPageable.Get());

ReturnIfFailed(heap->SetDebugName(descriptor.DebugName));
GPGMM_TRACE_EVENT_OBJECT_SNAPSHOT(heap.get(), descriptor);

if (ppHeapOut != nullptr) {
*ppHeapOut = heap.release();
}
Expand Down