From 16a51f3c03d5bc52ba67101fb5a5cd5b8d96fa94 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 22 Aug 2020 11:51:56 +0200 Subject: [PATCH] [dxvk] Only use half of the DEVICE_LOCAL | HOST_VISIBLE heap on Nvidia Seems to help with random crashes in FFXIV and potentially other games on 450 series drivers. --- src/dxvk/dxvk_memory.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index 3431c40c..32b011b5 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -177,6 +177,17 @@ namespace dxvk { m_memTypes[i].chunkSize = pickChunkSize(i); } + /* Work around an issue on Nvidia drivers where using the entire + * device_local | host_visible heap can cause crashes, presumably + * due to subsequent internal driver allocations failing */ + if (m_device->properties().core.properties.vendorID == uint16_t(DxvkGpuVendor::Nvidia)) { + for (uint32_t i = 0; i < m_memProps.memoryTypeCount; i++) { + constexpr VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + + if ((m_memTypes[i].memType.propertyFlags & flags) == flags) + m_memTypes[i].heap->budget = m_memTypes[i].heap->properties.size / 2; + } + } }