1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[dxvk] Don't oversubscribe memory heaps on UMA devices

Otherwise, we seem to suffer a major performance penalty
on setups with insufficient dedicated system memory.
This commit is contained in:
Philip Rebohle 2020-01-28 12:33:37 +01:00 committed by Joshie
parent 3beca254e2
commit ca4c03284f
2 changed files with 7 additions and 0 deletions

View File

@ -169,6 +169,8 @@ namespace dxvk {
m_memTypes[i].memTypeId = i;
m_memTypes[i].chunkSize = pickChunkSize(i);
}
m_restrictAllocations = m_device->isUnifiedMemoryArchitecture();
}
@ -309,6 +311,9 @@ namespace dxvk {
bool useMemoryPriority = (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
&& (m_device->features().extMemoryPriority.memoryPriority);
if (m_restrictAllocations && type->heap->stats.memoryAllocated + size > type->heap->properties.size)
return DxvkDeviceMemory();
DxvkDeviceMemory result;
result.memSize = size;
result.memFlags = flags;

View File

@ -284,6 +284,8 @@ namespace dxvk {
std::mutex m_mutex;
std::array<DxvkMemoryHeap, VK_MAX_MEMORY_HEAPS> m_memHeaps;
std::array<DxvkMemoryType, VK_MAX_MEMORY_TYPES> m_memTypes;
bool m_restrictAllocations;
DxvkMemory tryAlloc(
const VkMemoryRequirements* req,