From 7bc77b597e058a44d322ccb35202240c97a12a2b Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 22 May 2024 13:16:05 +0200 Subject: [PATCH] [dxvk] Enable VK_NV_descriptor_pool_overallocation if available --- src/dxvk/dxvk_adapter.cpp | 21 +++++++++++++++++++++ src/dxvk/dxvk_device_info.h | 1 + src/dxvk/dxvk_extensions.h | 1 + 3 files changed, 23 insertions(+) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index 4866465d..debbe011 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -420,6 +420,10 @@ namespace dxvk { enabledFeatures.khrPresentWait.presentWait = VK_FALSE; } + // Enable descriptor pool overallocation if supported + enabledFeatures.nvDescriptorPoolOverallocation.descriptorPoolOverallocation = + m_deviceFeatures.nvDescriptorPoolOverallocation.descriptorPoolOverallocation; + // Enable raw access chains for shader backends enabledFeatures.nvRawAccessChains.shaderRawAccessChains = m_deviceFeatures.nvRawAccessChains.shaderRawAccessChains; @@ -612,6 +616,10 @@ namespace dxvk { enabledFeatures.khrPresentWait = *reinterpret_cast(f); break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV: + enabledFeatures.nvDescriptorPoolOverallocation = *reinterpret_cast(f); + break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAW_ACCESS_CHAINS_FEATURES_NV: enabledFeatures.nvRawAccessChains = *reinterpret_cast(f); break; @@ -924,6 +932,11 @@ namespace dxvk { m_deviceFeatures.khrPresentWait.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.khrPresentWait); } + if (m_deviceExtensions.supports(VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME)) { + m_deviceFeatures.nvDescriptorPoolOverallocation.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; + m_deviceFeatures.nvDescriptorPoolOverallocation.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.nvDescriptorPoolOverallocation); + } + if (m_deviceExtensions.supports(VK_NV_RAW_ACCESS_CHAINS_EXTENSION_NAME)) { m_deviceFeatures.nvRawAccessChains.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAW_ACCESS_CHAINS_FEATURES_NV; m_deviceFeatures.nvRawAccessChains.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.nvRawAccessChains); @@ -996,6 +1009,7 @@ namespace dxvk { &devExtensions.khrPresentWait, &devExtensions.khrSwapchain, &devExtensions.khrWin32KeyedMutex, + &devExtensions.nvDescriptorPoolOverallocation, &devExtensions.nvRawAccessChains, &devExtensions.nvxBinaryImport, &devExtensions.nvxImageViewHandle, @@ -1136,6 +1150,11 @@ namespace dxvk { enabledFeatures.khrPresentWait.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.khrPresentWait); } + if (devExtensions.nvDescriptorPoolOverallocation) { + enabledFeatures.nvDescriptorPoolOverallocation.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV; + enabledFeatures.nvDescriptorPoolOverallocation.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.nvDescriptorPoolOverallocation); + } + if (devExtensions.nvRawAccessChains) { enabledFeatures.nvRawAccessChains.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAW_ACCESS_CHAINS_FEATURES_NV; enabledFeatures.nvRawAccessChains.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.nvRawAccessChains); @@ -1287,6 +1306,8 @@ namespace dxvk { "\n presentId : ", features.khrPresentId.presentId ? "1" : "0", "\n", VK_KHR_PRESENT_WAIT_EXTENSION_NAME, "\n presentWait : ", features.khrPresentWait.presentWait ? "1" : "0", + "\n", VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME, + "\n descriptorPoolOverallocation : ", features.nvDescriptorPoolOverallocation.descriptorPoolOverallocation ? "1" : "0", "\n", VK_NV_RAW_ACCESS_CHAINS_EXTENSION_NAME, "\n shaderRawAccessChains : ", features.nvRawAccessChains.shaderRawAccessChains ? "1" : "0", "\n", VK_NVX_BINARY_IMPORT_EXTENSION_NAME, diff --git a/src/dxvk/dxvk_device_info.h b/src/dxvk/dxvk_device_info.h index a629c01e..0c4c4e4c 100644 --- a/src/dxvk/dxvk_device_info.h +++ b/src/dxvk/dxvk_device_info.h @@ -71,6 +71,7 @@ namespace dxvk { VkPhysicalDeviceMaintenance5FeaturesKHR khrMaintenance5; VkPhysicalDevicePresentIdFeaturesKHR khrPresentId; VkPhysicalDevicePresentWaitFeaturesKHR khrPresentWait; + VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV nvDescriptorPoolOverallocation; VkPhysicalDeviceRawAccessChainsFeaturesNV nvRawAccessChains; VkBool32 nvxBinaryImport; VkBool32 nvxImageViewHandle; diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index 63c922cf..729f09c1 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -325,6 +325,7 @@ namespace dxvk { DxvkExt khrPresentWait = { VK_KHR_PRESENT_WAIT_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt khrSwapchain = { VK_KHR_SWAPCHAIN_EXTENSION_NAME, DxvkExtMode::Required }; DxvkExt khrWin32KeyedMutex = { VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME, DxvkExtMode::Optional }; + DxvkExt nvDescriptorPoolOverallocation = { VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt nvRawAccessChains = { VK_NV_RAW_ACCESS_CHAINS_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt nvxBinaryImport = { VK_NVX_BINARY_IMPORT_EXTENSION_NAME, DxvkExtMode::Disabled }; DxvkExt nvxImageViewHandle = { VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME, DxvkExtMode::Disabled };