From 81b89cf31d8a065524beda7742d55aa5d98b04f3 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 14 Jul 2022 20:29:53 +0200 Subject: [PATCH] [dxvk] Simplify Nvidia HVV workaround We no longer support 465 series drivers, so the check was obsolete. --- dxvk.conf | 13 ++++++------- src/dxvk/dxvk_memory.cpp | 24 +++++++++--------------- src/dxvk/dxvk_options.cpp | 2 +- src/dxvk/dxvk_options.h | 2 +- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/dxvk.conf b/dxvk.conf index 6839cd3d..fedc2814 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -251,16 +251,15 @@ # Controls Nvidia HVV behaviour. # -# Disables the host-visible, device-local heap on Nvidia drivers. This -# is used to avoid NVIDIA driver bug 3114283 on affected drivers, as -# well as in specific games on newer drivers.being enabled on all -# affected drivers. +# Restricts use of the host-visible, device-local heap on Nvidia drivers. +# This is used to avoid NVIDIA driver bug 3114283 on affected drivers, as +# well as in specific games on newer drivers. # # Supported values: -# - Auto: Don't change the default -# - True, False: Always enable / disable +# - True: Restrict HVV usage +# - False: Do not restrict HVV usage -# dxvk.shrinkNvidiaHvvHeap = Auto +# dxvk.shrinkNvidiaHvvHeap = False # Controls graphics pipeline library behaviour diff --git a/src/dxvk/dxvk_memory.cpp b/src/dxvk/dxvk_memory.cpp index fdbb0d4c..279700d8 100644 --- a/src/dxvk/dxvk_memory.cpp +++ b/src/dxvk/dxvk_memory.cpp @@ -214,22 +214,16 @@ namespace dxvk { 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)) { - bool shrinkNvidiaHvvHeap = device->adapter()->matchesDriver( - VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, VK_MAKE_VERSION(465, 0, 0)); + /* Work around an issue on Nvidia drivers where using the + * entire HVV heap can cause slowdowns in specific games */ + if (device->adapter()->matchesDriver(VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0) + && device->config().shrinkNvidiaHvvHeap) { + for (uint32_t i = 0; i < m_memProps.memoryTypeCount; i++) { + VkMemoryPropertyFlags hvvFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; - applyTristate(shrinkNvidiaHvvHeap, device->config().shrinkNvidiaHvvHeap); - - if (shrinkNvidiaHvvHeap) { - for (uint32_t i = 0; i < m_memProps.memoryTypeCount; i++) { - VkMemoryPropertyFlags hvvFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; - - if ((m_memTypes[i].memType.propertyFlags & hvvFlags) == hvvFlags - && (m_memTypes[i].heap->properties.size < largestDeviceLocalHeap)) - m_memTypes[i].heap->budget = 32 << 20; - } + if ((m_memTypes[i].memType.propertyFlags & hvvFlags) == hvvFlags + && (m_memTypes[i].heap->properties.size < largestDeviceLocalHeap)) + m_memTypes[i].heap->budget = 32 << 20; } } } diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 87f26186..d251cbcf 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -8,7 +8,7 @@ namespace dxvk { numCompilerThreads = config.getOption ("dxvk.numCompilerThreads", 0); enableGraphicsPipelineLibrary = config.getOption("dxvk.enableGraphicsPipelineLibrary", Tristate::Auto); useRawSsbo = config.getOption("dxvk.useRawSsbo", Tristate::Auto); - shrinkNvidiaHvvHeap = config.getOption("dxvk.shrinkNvidiaHvvHeap", Tristate::Auto); + shrinkNvidiaHvvHeap = config.getOption ("dxvk.shrinkNvidiaHvvHeap", false); hud = config.getOption("dxvk.hud", ""); } diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index 18210fa6..c2f7f11b 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -25,7 +25,7 @@ namespace dxvk { Tristate useRawSsbo; /// Workaround for NVIDIA driver bug 3114283 - Tristate shrinkNvidiaHvvHeap; + bool shrinkNvidiaHvvHeap; /// HUD elements std::string hud;