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

[dxvk] Don't shrink HVV heap if it's the main video memory heap

May fix issues on RBAR-enabled Nvidia systems.
This commit is contained in:
Philip Rebohle 2022-01-16 02:47:51 +01:00
parent 703cc78cc0
commit a268de51e3
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -202,6 +202,17 @@ namespace dxvk {
m_memTypes[i].memTypeId = i;
}
/* Check what kind of heap the HVV memory type is on, if any. If the
* HVV memory type is on the largest device-local heap, we either have
* an UMA system or an RBAR-enabled system. Otherwise, there will likely
* be a separate, smaller heap for it. */
VkDeviceSize largestDeviceLocalHeap = 0;
for (uint32_t i = 0; i < m_memProps.memoryTypeCount; i++) {
if (m_memTypes[i].memType.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
largestDeviceLocalHeap = std::max(largestDeviceLocalHeap, m_memTypes[i].heap->properties.size);
}
/* Work around an issue on Nvidia drivers where using the entire
* device_local | host_visible heap can cause crashes or slowdowns */
if (m_device->properties().core.properties.vendorID == uint16_t(DxvkGpuVendor::Nvidia)) {
@ -212,9 +223,10 @@ namespace dxvk {
if (shrinkNvidiaHvvHeap) {
for (uint32_t i = 0; i < m_memProps.memoryTypeCount; i++) {
VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
VkMemoryPropertyFlags hvvFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
if ((m_memTypes[i].memType.propertyFlags & flags) == flags)
if ((m_memTypes[i].memType.propertyFlags & hvvFlags) == hvvFlags
&& (m_memTypes[i].heap->properties.size < largestDeviceLocalHeap))
m_memTypes[i].heap->budget = 32 << 20;
}
}