From 9f3fb028b0d8ff170a411480b28838f97fc78fdf Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 22 Jun 2020 13:04:00 +0200 Subject: [PATCH] [dxvk] Enable VK_EXT_extended_dynamic_state if available. --- src/dxvk/dxvk_adapter.cpp | 17 ++++++++++++++++- src/dxvk/dxvk_device_info.h | 1 + src/dxvk/dxvk_extensions.h | 1 + src/vulkan/vulkan_loader.h | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index ee3b270f..d7402fe9 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -230,6 +230,8 @@ namespace dxvk { || !required.extCustomBorderColor.customBorderColorWithoutFormat) && (m_deviceFeatures.extDepthClipEnable.depthClipEnable || !required.extDepthClipEnable.depthClipEnable) + && (m_deviceFeatures.extExtendedDynamicState.extendedDynamicState + || !required.extExtendedDynamicState.extendedDynamicState) && (m_deviceFeatures.extHostQueryReset.hostQueryReset || !required.extHostQueryReset.hostQueryReset) && (m_deviceFeatures.extMemoryPriority.memoryPriority @@ -259,12 +261,13 @@ namespace dxvk { DxvkDeviceFeatures enabledFeatures) { DxvkDeviceExtensions devExtensions; - std::array devExtensionList = {{ + std::array devExtensionList = {{ &devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdShaderFragmentMask, &devExtensions.extConditionalRendering, &devExtensions.extCustomBorderColor, &devExtensions.extDepthClipEnable, + &devExtensions.extExtendedDynamicState, &devExtensions.extFullScreenExclusive, &devExtensions.extHostQueryReset, &devExtensions.extMemoryBudget, @@ -329,6 +332,11 @@ namespace dxvk { enabledFeatures.extDepthClipEnable.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extDepthClipEnable); } + if (devExtensions.extExtendedDynamicState) { + enabledFeatures.extExtendedDynamicState.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; + enabledFeatures.extExtendedDynamicState.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extExtendedDynamicState); + } + if (devExtensions.extHostQueryReset) { enabledFeatures.extHostQueryReset.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT; enabledFeatures.extHostQueryReset.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extHostQueryReset); @@ -570,6 +578,11 @@ namespace dxvk { m_deviceFeatures.extDepthClipEnable.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extDepthClipEnable); } + if (m_deviceExtensions.supports(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME)) { + m_deviceFeatures.extExtendedDynamicState.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; + m_deviceFeatures.extExtendedDynamicState.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extExtendedDynamicState); + } + if (m_deviceExtensions.supports(VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME)) { m_deviceFeatures.extHostQueryReset.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT; m_deviceFeatures.extHostQueryReset.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extHostQueryReset); @@ -673,6 +686,8 @@ namespace dxvk { "\n customBorderColorWithoutFormat : ", features.extCustomBorderColor.customBorderColorWithoutFormat ? "1" : "0", "\n", VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME, "\n depthClipEnable : ", features.extDepthClipEnable.depthClipEnable ? "1" : "0", + "\n", VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, + "\n extendedDynamicState : ", features.extExtendedDynamicState.extendedDynamicState ? "1" : "0", "\n", VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, "\n hostQueryReset : ", features.extHostQueryReset.hostQueryReset ? "1" : "0", "\n", VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME, diff --git a/src/dxvk/dxvk_device_info.h b/src/dxvk/dxvk_device_info.h index 2786ff2b..c42b2957 100644 --- a/src/dxvk/dxvk_device_info.h +++ b/src/dxvk/dxvk_device_info.h @@ -38,6 +38,7 @@ namespace dxvk { VkPhysicalDeviceConditionalRenderingFeaturesEXT extConditionalRendering; VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor; VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable; + VkPhysicalDeviceExtendedDynamicStateFeaturesEXT extExtendedDynamicState; VkPhysicalDeviceHostQueryResetFeaturesEXT extHostQueryReset; VkPhysicalDeviceMemoryPriorityFeaturesEXT extMemoryPriority; VkPhysicalDeviceRobustness2FeaturesEXT extRobustness2; diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index fdcabaef..cc141d51 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -263,6 +263,7 @@ namespace dxvk { DxvkExt extConditionalRendering = { VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME, DxvkExtMode::Disabled }; DxvkExt extCustomBorderColor = { VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extDepthClipEnable = { VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME, DxvkExtMode::Optional }; + DxvkExt extExtendedDynamicState = { VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extFullScreenExclusive = { VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extHostQueryReset = { VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extMemoryBudget = { VK_EXT_MEMORY_BUDGET_EXTENSION_NAME, DxvkExtMode::Passive }; diff --git a/src/vulkan/vulkan_loader.h b/src/vulkan/vulkan_loader.h index e2a9f7e0..852b3f52 100644 --- a/src/vulkan/vulkan_loader.h +++ b/src/vulkan/vulkan_loader.h @@ -308,6 +308,21 @@ namespace dxvk::vk { VULKAN_FN(vkCmdEndConditionalRenderingEXT); #endif + #ifdef VK_EXT_extended_dynamic_state + VULKAN_FN(vkCmdBindVertexBuffers2EXT); + VULKAN_FN(vkCmdSetCullModeEXT); + VULKAN_FN(vkCmdSetDepthBoundsTestEnableEXT); + VULKAN_FN(vkCmdSetDepthCompareOpEXT); + VULKAN_FN(vkCmdSetDepthTestEnableEXT); + VULKAN_FN(vkCmdSetDepthWriteEnableEXT); + VULKAN_FN(vkCmdSetFrontFaceEXT); + VULKAN_FN(vkCmdSetPrimitiveTopologyEXT); + VULKAN_FN(vkCmdSetScissorWithCountEXT); + VULKAN_FN(vkCmdSetStencilOpEXT); + VULKAN_FN(vkCmdSetStencilTestEnableEXT); + VULKAN_FN(vkCmdSetViewportWithCountEXT); + #endif + #ifdef VK_EXT_full_screen_exclusive VULKAN_FN(vkAcquireFullScreenExclusiveModeEXT); VULKAN_FN(vkReleaseFullScreenExclusiveModeEXT);