From a968f29754f8bdc20221143d40802548acfacc76 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 4 May 2020 13:27:19 +0200 Subject: [PATCH] [dxvk] Enable VK_EXT_custom_border_color if available --- src/dxvk/dxvk_adapter.cpp | 25 ++++++++++++++++++++++++- src/dxvk/dxvk_device_info.h | 2 ++ src/dxvk/dxvk_extensions.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index a360e82c..a2e900bc 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -217,6 +217,10 @@ namespace dxvk { || !required.shaderDrawParameters.shaderDrawParameters) && (m_deviceFeatures.extConditionalRendering.conditionalRendering || !required.extConditionalRendering.conditionalRendering) + && (m_deviceFeatures.extCustomBorderColor.customBorderColors + || !required.extCustomBorderColor.customBorderColors) + && (m_deviceFeatures.extCustomBorderColor.customBorderColorWithoutFormat + || !required.extCustomBorderColor.customBorderColorWithoutFormat) && (m_deviceFeatures.extDepthClipEnable.depthClipEnable || !required.extDepthClipEnable.depthClipEnable) && (m_deviceFeatures.extHostQueryReset.hostQueryReset @@ -248,10 +252,11 @@ namespace dxvk { DxvkDeviceFeatures enabledFeatures) { DxvkDeviceExtensions devExtensions; - std::array devExtensionList = {{ + std::array devExtensionList = {{ &devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdShaderFragmentMask, &devExtensions.extConditionalRendering, + &devExtensions.extCustomBorderColor, &devExtensions.extDepthClipEnable, &devExtensions.extFullScreenExclusive, &devExtensions.extHostQueryReset, @@ -307,6 +312,11 @@ namespace dxvk { enabledFeatures.extConditionalRendering.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extConditionalRendering); } + if (devExtensions.extCustomBorderColor) { + enabledFeatures.extCustomBorderColor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; + enabledFeatures.extCustomBorderColor.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extCustomBorderColor); + } + if (devExtensions.extDepthClipEnable) { enabledFeatures.extDepthClipEnable.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; enabledFeatures.extDepthClipEnable.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extDepthClipEnable); @@ -487,6 +497,11 @@ namespace dxvk { m_deviceInfo.coreSubgroup.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; m_deviceInfo.coreSubgroup.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.coreSubgroup); + if (m_deviceExtensions.supports(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME)) { + m_deviceInfo.extCustomBorderColor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT; + m_deviceInfo.extCustomBorderColor.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.extCustomBorderColor); + } + if (m_deviceExtensions.supports(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME)) { m_deviceInfo.extRobustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT; m_deviceInfo.extRobustness2.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.extRobustness2); @@ -538,6 +553,11 @@ namespace dxvk { m_deviceFeatures.extConditionalRendering.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extConditionalRendering); } + if (m_deviceExtensions.supports(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME)) { + m_deviceFeatures.extCustomBorderColor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT; + m_deviceFeatures.extCustomBorderColor.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extCustomBorderColor); + } + if (m_deviceExtensions.supports(VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME)) { m_deviceFeatures.extDepthClipEnable.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT; m_deviceFeatures.extDepthClipEnable.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extDepthClipEnable); @@ -641,6 +661,9 @@ namespace dxvk { "\n variableMultisampleRate : ", features.core.features.variableMultisampleRate ? "1" : "0", "\n", VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME, "\n conditionalRendering : ", features.extConditionalRendering.conditionalRendering ? "1" : "0", + "\n", VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, + "\n customBorderColors : ", features.extCustomBorderColor.customBorderColors ? "1" : "0", + "\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_HOST_QUERY_RESET_EXTENSION_NAME, diff --git a/src/dxvk/dxvk_device_info.h b/src/dxvk/dxvk_device_info.h index d24b4d3c..2786ff2b 100644 --- a/src/dxvk/dxvk_device_info.h +++ b/src/dxvk/dxvk_device_info.h @@ -16,6 +16,7 @@ namespace dxvk { VkPhysicalDeviceProperties2 core; VkPhysicalDeviceIDProperties coreDeviceId; VkPhysicalDeviceSubgroupProperties coreSubgroup; + VkPhysicalDeviceCustomBorderColorPropertiesEXT extCustomBorderColor; VkPhysicalDeviceRobustness2PropertiesEXT extRobustness2; VkPhysicalDeviceTransformFeedbackPropertiesEXT extTransformFeedback; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT extVertexAttributeDivisor; @@ -35,6 +36,7 @@ namespace dxvk { VkPhysicalDeviceFeatures2 core; VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParameters; VkPhysicalDeviceConditionalRenderingFeaturesEXT extConditionalRendering; + VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor; VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable; VkPhysicalDeviceHostQueryResetFeaturesEXT extHostQueryReset; VkPhysicalDeviceMemoryPriorityFeaturesEXT extMemoryPriority; diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index 5d86a081..fdcabaef 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -261,6 +261,7 @@ namespace dxvk { DxvkExt amdMemoryOverallocationBehaviour = { VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt amdShaderFragmentMask = { VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME, DxvkExtMode::Optional }; 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 extFullScreenExclusive = { VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extHostQueryReset = { VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME, DxvkExtMode::Optional };