diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 6e8a4b5ed..32c049518 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -1205,7 +1205,7 @@ namespace gpgmm::d3d12 { } ComPtr committedResource; - Heap* resourceHeap = nullptr; + ComPtr resourceHeap; ReturnIfFailed(CreateCommittedResource(heapProperties, heapFlags, resourceInfo, &newResourceDesc, clearValue, initialResourceState, &committedResource, &resourceHeap)); @@ -1221,12 +1221,13 @@ namespace gpgmm::d3d12 { allocationDesc.HeapOffset = kInvalidOffset; allocationDesc.SizeInBytes = request.SizeInBytes; allocationDesc.Method = AllocationMethod::kStandalone; - allocationDesc.OffsetFromResource = 0; allocationDesc.DebugName = allocationDescriptor.DebugName; - *ppResourceAllocationOut = - new ResourceAllocation(allocationDesc, mResidencyManager.Get(), this, resourceHeap, - nullptr, std::move(committedResource)); + if (ppResourceAllocationOut != nullptr) { + *ppResourceAllocationOut = new ResourceAllocation( + allocationDesc, mResidencyManager.Get(), this, resourceHeap.Detach(), nullptr, + std::move(committedResource)); + } return S_OK; }