From 1046582d1ddd8f0ef6798610df35ff59e086923e Mon Sep 17 00:00:00 2001 From: Nathan Voglsam Date: Thu, 24 Aug 2023 22:02:03 +1000 Subject: [PATCH] Fix GetResourceAllocationInfo2 and GetResourceAllocationInfo calls to work with DirectX-Headers header files --- src/D3D12MemAlloc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/D3D12MemAlloc.cpp b/src/D3D12MemAlloc.cpp index bb319c3..9972ff5 100644 --- a/src/D3D12MemAlloc.cpp +++ b/src/D3D12MemAlloc.cpp @@ -8187,7 +8187,12 @@ HRESULT AllocatorPimpl::UpdateD3D12Budget() D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(const D3D12_RESOURCE_DESC& resourceDesc) const { +#if defined(_MSC_VER) || !defined(_WIN32) return m_Device->GetResourceAllocationInfo(0, 1, &resourceDesc); +#else + D3D12_RESOURCE_ALLOCATION_INFO RetVal; + return *m_Device->GetResourceAllocationInfo(&RetVal, 0, 1, &resourceDesc); +#endif } #ifdef __ID3D12Device8_INTERFACE_DEFINED__ @@ -8195,7 +8200,12 @@ D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(c { D3D12MA_ASSERT(m_Device8 != NULL); D3D12_RESOURCE_ALLOCATION_INFO1 info1Unused; +#if defined(_MSC_VER) || !defined(_WIN32) return m_Device8->GetResourceAllocationInfo2(0, 1, &resourceDesc, &info1Unused); +#else + D3D12_RESOURCE_ALLOCATION_INFO RetVal; + return *m_Device8->GetResourceAllocationInfo2(&RetVal, 0, 1, &resourceDesc, &info1Unused); +#endif } #endif // #ifdef __ID3D12Device8_INTERFACE_DEFINED__