From dfa8524e7352228d3176340112ebc0165967f991 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 30 Jan 2019 13:30:20 +0100 Subject: [PATCH] [dxvk] Wire up memory priority to device memory allocations --- src/dxvk/dxvk_memory.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index 6dabf433..acb80e24 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -293,19 +293,22 @@ namespace dxvk { VkDeviceSize size, float priority, const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo) { - if ((type->memType.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) - && (type->heap->stats.memoryAllocated + size > type->heap->properties.size) - && (!m_allowOvercommit)) - return DxvkDeviceMemory(); + bool useMemoryPriority = (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + && (m_device->features().extMemoryPriority.memoryPriority); DxvkDeviceMemory result; result.memSize = size; result.memFlags = flags; result.priority = priority; + VkMemoryPriorityAllocateInfoEXT prio; + prio.sType = VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT; + prio.pNext = nullptr; + prio.priority = priority; + VkMemoryAllocateInfo info; info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; - info.pNext = dedAllocInfo; + info.pNext = useMemoryPriority ? &prio : prio.pNext; info.allocationSize = size; info.memoryTypeIndex = type->memTypeId;