1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[dxvk] Move isUnifiedMemoryArchitecture to adapter

This commit is contained in:
Joshua Ashton 2021-05-11 23:41:29 +01:00 committed by Philip Rebohle
parent e624cfa0b4
commit fe0dc2d579
3 changed files with 21 additions and 7 deletions

View File

@ -497,6 +497,17 @@ namespace dxvk {
}
bool DxvkAdapter::isUnifiedMemoryArchitecture() const {
auto memory = this->memoryProperties();
bool result = true;
for (uint32_t i = 0; i < memory.memoryHeapCount; i++)
result &= memory.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
return result;
}
void DxvkAdapter::initHeapAllocInfo() {
for (uint32_t i = 0; i < m_heapAlloc.size(); i++)
m_heapAlloc[i] = 0;

View File

@ -247,6 +247,15 @@ namespace dxvk {
*/
void logAdapterInfo() const;
/**
* \brief Checks whether this is a UMA system
*
* Basically tests whether all heaps are device-local.
* Can be used for various optimizations in client APIs.
* \returns \c true if the system has unified memory.
*/
bool isUnifiedMemoryArchitecture() const;
private:
Rc<vk::InstanceFn> m_vki;

View File

@ -33,13 +33,7 @@ namespace dxvk {
bool DxvkDevice::isUnifiedMemoryArchitecture() const {
auto memory = m_adapter->memoryProperties();
bool result = true;
for (uint32_t i = 0; i < memory.memoryHeapCount; i++)
result &= memory.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
return result;
return m_adapter->isUnifiedMemoryArchitecture();
}