mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 19:24:11 +01:00
[dxvk] Wire up memory priority to device memory allocations
This commit is contained in:
parent
03b488772d
commit
dfa8524e73
@ -293,19 +293,22 @@ namespace dxvk {
|
|||||||
VkDeviceSize size,
|
VkDeviceSize size,
|
||||||
float priority,
|
float priority,
|
||||||
const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo) {
|
const VkMemoryDedicatedAllocateInfoKHR* dedAllocInfo) {
|
||||||
if ((type->memType.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
|
bool useMemoryPriority = (flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
|
||||||
&& (type->heap->stats.memoryAllocated + size > type->heap->properties.size)
|
&& (m_device->features().extMemoryPriority.memoryPriority);
|
||||||
&& (!m_allowOvercommit))
|
|
||||||
return DxvkDeviceMemory();
|
|
||||||
|
|
||||||
DxvkDeviceMemory result;
|
DxvkDeviceMemory result;
|
||||||
result.memSize = size;
|
result.memSize = size;
|
||||||
result.memFlags = flags;
|
result.memFlags = flags;
|
||||||
result.priority = priority;
|
result.priority = priority;
|
||||||
|
|
||||||
|
VkMemoryPriorityAllocateInfoEXT prio;
|
||||||
|
prio.sType = VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT;
|
||||||
|
prio.pNext = nullptr;
|
||||||
|
prio.priority = priority;
|
||||||
|
|
||||||
VkMemoryAllocateInfo info;
|
VkMemoryAllocateInfo info;
|
||||||
info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||||
info.pNext = dedAllocInfo;
|
info.pNext = useMemoryPriority ? &prio : prio.pNext;
|
||||||
info.allocationSize = size;
|
info.allocationSize = size;
|
||||||
info.memoryTypeIndex = type->memTypeId;
|
info.memoryTypeIndex = type->memTypeId;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user