diff --git a/src/gpgmm/d3d12/ErrorD3D12.h b/src/gpgmm/d3d12/ErrorD3D12.h index 5cc8a34b9..7c4896f9e 100644 --- a/src/gpgmm/d3d12/ErrorD3D12.h +++ b/src/gpgmm/d3d12/ErrorD3D12.h @@ -22,13 +22,14 @@ namespace gpgmm::d3d12 { -#define ReturnIfNullptr(expr) \ - { \ - if (GPGMM_UNLIKELY(expr == nullptr)) { \ - return E_POINTER; \ - } \ - } \ - for (;;) \ +#define ReturnIfNullptr(expr) \ + { \ + if (GPGMM_UNLIKELY(expr == nullptr)) { \ + gpgmm::ErrorLog() << #expr << ": " << GetErrorMessage(E_POINTER); \ + return E_POINTER; \ + } \ + } \ + for (;;) \ break #define ReturnIfFailed(expr) \ diff --git a/src/gpgmm/d3d12/HeapD3D12.cpp b/src/gpgmm/d3d12/HeapD3D12.cpp index fc74a8fc6..f009476a3 100644 --- a/src/gpgmm/d3d12/HeapD3D12.cpp +++ b/src/gpgmm/d3d12/HeapD3D12.cpp @@ -88,10 +88,7 @@ namespace gpgmm::d3d12 { ReturnIfFailed(createHeapFn(pCreateHeapContext, &pageable)); // Pageable-based type is required for residency-managed heaps. - if (pageable == nullptr) { - gpgmm::ErrorLog() << "Unable to create heap because memory does not exist."; - return E_POINTER; - } + ReturnIfNullptr(pageable); GPGMM_TRACE_EVENT_OBJECT_CALL("Heap.CreateHeap", (CREATE_HEAP_DESC{descriptor, pageable.Get()}));