mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git
synced 2024-11-21 19:50:05 +00:00
Added Allocator::IsUMA, IsCacheCoherentUMA
Also fixes in TestDevice4.
This commit is contained in:
parent
45014bd2f3
commit
35e67c8562
@ -2768,6 +2768,8 @@ public:
|
|||||||
// Shortcut for "Allocation Callbacks", because this function is called so often.
|
// Shortcut for "Allocation Callbacks", because this function is called so often.
|
||||||
const ALLOCATION_CALLBACKS& GetAllocs() const { return m_AllocationCallbacks; }
|
const ALLOCATION_CALLBACKS& GetAllocs() const { return m_AllocationCallbacks; }
|
||||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS& GetD3D12Options() const { return m_D3D12Options; }
|
const D3D12_FEATURE_DATA_D3D12_OPTIONS& GetD3D12Options() const { return m_D3D12Options; }
|
||||||
|
BOOL IsUMA() const { return m_D3D12Architecture.UMA; }
|
||||||
|
BOOL IsCacheCoherentUMA() const { return m_D3D12Architecture.CacheCoherentUMA; }
|
||||||
bool SupportsResourceHeapTier2() const { return m_D3D12Options.ResourceHeapTier >= D3D12_RESOURCE_HEAP_TIER_2; }
|
bool SupportsResourceHeapTier2() const { return m_D3D12Options.ResourceHeapTier >= D3D12_RESOURCE_HEAP_TIER_2; }
|
||||||
bool UseMutex() const { return m_UseMutex; }
|
bool UseMutex() const { return m_UseMutex; }
|
||||||
AllocationObjectAllocator& GetAllocationObjectAllocator() { return m_AllocationObjectAllocator; }
|
AllocationObjectAllocator& GetAllocationObjectAllocator() { return m_AllocationObjectAllocator; }
|
||||||
@ -2885,6 +2887,7 @@ private:
|
|||||||
D3D12MA_ATOMIC_UINT32 m_CurrentFrameIndex;
|
D3D12MA_ATOMIC_UINT32 m_CurrentFrameIndex;
|
||||||
DXGI_ADAPTER_DESC m_AdapterDesc;
|
DXGI_ADAPTER_DESC m_AdapterDesc;
|
||||||
D3D12_FEATURE_DATA_D3D12_OPTIONS m_D3D12Options;
|
D3D12_FEATURE_DATA_D3D12_OPTIONS m_D3D12Options;
|
||||||
|
D3D12_FEATURE_DATA_ARCHITECTURE m_D3D12Architecture;
|
||||||
AllocationObjectAllocator m_AllocationObjectAllocator;
|
AllocationObjectAllocator m_AllocationObjectAllocator;
|
||||||
|
|
||||||
typedef IntrusiveLinkedList<CommittedAllocationListItemTraits> CommittedAllocationList;
|
typedef IntrusiveLinkedList<CommittedAllocationListItemTraits> CommittedAllocationList;
|
||||||
@ -4485,6 +4488,7 @@ AllocatorPimpl::AllocatorPimpl(const ALLOCATION_CALLBACKS& allocationCallbacks,
|
|||||||
{
|
{
|
||||||
// desc.pAllocationCallbacks intentionally ignored here, preprocessed by CreateAllocator.
|
// desc.pAllocationCallbacks intentionally ignored here, preprocessed by CreateAllocator.
|
||||||
ZeroMemory(&m_D3D12Options, sizeof(m_D3D12Options));
|
ZeroMemory(&m_D3D12Options, sizeof(m_D3D12Options));
|
||||||
|
ZeroMemory(&m_D3D12Architecture, sizeof(m_D3D12Architecture));
|
||||||
|
|
||||||
ZeroMemory(m_BlockVectors, sizeof(m_BlockVectors));
|
ZeroMemory(m_BlockVectors, sizeof(m_BlockVectors));
|
||||||
ZeroMemory(m_DefaultPoolTier1MinBytes, sizeof(m_DefaultPoolTier1MinBytes));
|
ZeroMemory(m_DefaultPoolTier1MinBytes, sizeof(m_DefaultPoolTier1MinBytes));
|
||||||
@ -4527,6 +4531,13 @@ HRESULT AllocatorPimpl::Init(const ALLOCATOR_DESC& desc)
|
|||||||
m_D3D12Options.ResourceHeapTier = (D3D12MA_FORCE_RESOURCE_HEAP_TIER);
|
m_D3D12Options.ResourceHeapTier = (D3D12MA_FORCE_RESOURCE_HEAP_TIER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
hr = m_Device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &m_D3D12Architecture, sizeof(m_D3D12Architecture));
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
m_D3D12Architecture.UMA = FALSE;
|
||||||
|
m_D3D12Architecture.CacheCoherentUMA = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
D3D12_HEAP_PROPERTIES heapProps = {};
|
D3D12_HEAP_PROPERTIES heapProps = {};
|
||||||
const UINT defaultPoolCount = CalcDefaultPoolCount();
|
const UINT defaultPoolCount = CalcDefaultPoolCount();
|
||||||
for(UINT i = 0; i < defaultPoolCount; ++i)
|
for(UINT i = 0; i < defaultPoolCount; ++i)
|
||||||
@ -6291,6 +6302,14 @@ const D3D12_FEATURE_DATA_D3D12_OPTIONS& Allocator::GetD3D12Options() const
|
|||||||
{
|
{
|
||||||
return m_Pimpl->GetD3D12Options();
|
return m_Pimpl->GetD3D12Options();
|
||||||
}
|
}
|
||||||
|
BOOL Allocator::IsUMA() const
|
||||||
|
{
|
||||||
|
return m_Pimpl->IsUMA();
|
||||||
|
}
|
||||||
|
BOOL Allocator::IsCacheCoherentUMA() const
|
||||||
|
{
|
||||||
|
return m_Pimpl->IsCacheCoherentUMA();
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT Allocator::CreateResource(
|
HRESULT Allocator::CreateResource(
|
||||||
const ALLOCATION_DESC* pAllocDesc,
|
const ALLOCATION_DESC* pAllocDesc,
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/** \mainpage D3D12 Memory Allocator
|
/** \mainpage D3D12 Memory Allocator
|
||||||
|
|
||||||
<b>Version 2.0.0-development</b> (2021-02-16)
|
<b>Version 2.0.0-development</b> (2021-03-11)
|
||||||
|
|
||||||
Copyright (c) 2019-2021 Advanced Micro Devices, Inc. All rights reserved. \n
|
Copyright (c) 2019-2021 Advanced Micro Devices, Inc. All rights reserved. \n
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -1227,6 +1227,22 @@ public:
|
|||||||
|
|
||||||
/// Returns cached options retrieved from D3D12 device.
|
/// Returns cached options retrieved from D3D12 device.
|
||||||
const D3D12_FEATURE_DATA_D3D12_OPTIONS& GetD3D12Options() const;
|
const D3D12_FEATURE_DATA_D3D12_OPTIONS& GetD3D12Options() const;
|
||||||
|
/** \brief Returns true if `D3D12_FEATURE_DATA_ARCHITECTURE1::UMA` was found to be true.
|
||||||
|
|
||||||
|
For more information about how to use it, see articles in Microsoft Docs:
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/direct3d12/default-texture-mapping
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_feature_data_architecture
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getcustomheapproperties
|
||||||
|
*/
|
||||||
|
BOOL IsUMA() const;
|
||||||
|
/** \brief Returns true if `D3D12_FEATURE_DATA_ARCHITECTURE1::CacheCoherentUMA` was found to be true.
|
||||||
|
|
||||||
|
For more information about how to use it, see articles in Microsoft Docs:
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/direct3d12/default-texture-mapping
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_feature_data_architecture
|
||||||
|
- https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getcustomheapproperties
|
||||||
|
*/
|
||||||
|
BOOL IsCacheCoherentUMA() const;
|
||||||
|
|
||||||
/** \brief Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function.
|
/** \brief Allocates memory and creates a D3D12 resource (buffer or texture). This is the main allocation function.
|
||||||
|
|
||||||
|
@ -1422,11 +1422,22 @@ static void TestDevice4(const TestContext& ctx)
|
|||||||
wprintf(L"Test ID3D12Device4\n");
|
wprintf(L"Test ID3D12Device4\n");
|
||||||
|
|
||||||
CComPtr<ID3D12Device4> dev4;
|
CComPtr<ID3D12Device4> dev4;
|
||||||
CHECK_HR(ctx.device->QueryInterface(&dev4));
|
HRESULT hr = ctx.device->QueryInterface(&dev4);
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
wprintf(L"QueryInterface for ID3D12Device4 FAILED.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
D3D12_PROTECTED_RESOURCE_SESSION_DESC sessionDesc = {};
|
D3D12_PROTECTED_RESOURCE_SESSION_DESC sessionDesc = {};
|
||||||
CComPtr<ID3D12ProtectedResourceSession> session;
|
CComPtr<ID3D12ProtectedResourceSession> session;
|
||||||
CHECK_HR(dev4->CreateProtectedResourceSession(&sessionDesc, IID_PPV_ARGS(&session)));
|
// This fails on the SOFTWARE adapter.
|
||||||
|
hr = dev4->CreateProtectedResourceSession(&sessionDesc, IID_PPV_ARGS(&session));
|
||||||
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
|
wprintf(L"ID3D12Device4::CreateProtectedResourceSession FAILED.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a buffer
|
// Create a buffer
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user