Skip to content

Commit

Permalink
Merge pull request #59 from nathanvoglsam/fix-directx-header-support
Browse files Browse the repository at this point in the history
Fix GetResourceAllocationInfo2 and GetResourceAllocationInfo calls to work on non-msvc compilers with DirectX-Headers
  • Loading branch information
adam-sawicki-a authored Aug 24, 2023
2 parents 3b949bf + 1046582 commit 0e71874
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/D3D12MemAlloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8187,15 +8187,25 @@ 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__
D3D12_RESOURCE_ALLOCATION_INFO AllocatorPimpl::GetResourceAllocationInfoNative(const D3D12_RESOURCE_DESC1& resourceDesc) const
{
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__

Expand Down

0 comments on commit 0e71874

Please sign in to comment.