From 5fbb0dd4bab0bf172b9f0fc1519e6d94e7b18ee2 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 15 Jun 2023 12:02:33 +0100 Subject: [PATCH] [dxvk] Enable EXT_depth_bias_control --- src/dxvk/dxvk_adapter.cpp | 24 ++++++++++++++++++++++++ src/dxvk/dxvk_device_info.h | 1 + src/dxvk/dxvk_extensions.h | 1 + src/vulkan/vulkan_loader.h | 1 + 4 files changed, 27 insertions(+) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index fd1fb374..b8613b3f 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -244,6 +244,10 @@ namespace dxvk { && CHECK_FEATURE_NEED(extCustomBorderColor.customBorderColors) && CHECK_FEATURE_NEED(extCustomBorderColor.customBorderColorWithoutFormat) && CHECK_FEATURE_NEED(extDepthClipEnable.depthClipEnable) + && CHECK_FEATURE_NEED(extDepthBiasControl.depthBiasControl) + && CHECK_FEATURE_NEED(extDepthBiasControl.leastRepresentableValueForceUnormRepresentation) + && CHECK_FEATURE_NEED(extDepthBiasControl.floatRepresentation) + && CHECK_FEATURE_NEED(extDepthBiasControl.depthBiasExact) && CHECK_FEATURE_NEED(extGraphicsPipelineLibrary.graphicsPipelineLibrary) && CHECK_FEATURE_NEED(extMemoryBudget) && CHECK_FEATURE_NEED(extMemoryPriority.memoryPriority) @@ -513,6 +517,10 @@ namespace dxvk { enabledFeatures.extDepthClipEnable = *reinterpret_cast(f); break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT: + enabledFeatures.extDepthBiasControl = *reinterpret_cast(f); + break; + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT: enabledFeatures.extExtendedDynamicState3 = *reinterpret_cast(f); break; @@ -768,6 +776,11 @@ namespace dxvk { m_deviceFeatures.extDepthClipEnable.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extDepthClipEnable); } + if (m_deviceExtensions.supports(VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME)) { + m_deviceFeatures.extDepthBiasControl.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; + m_deviceFeatures.extDepthBiasControl.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extDepthBiasControl); + } + if (m_deviceExtensions.supports(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME)) { m_deviceFeatures.extExtendedDynamicState3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; m_deviceFeatures.extExtendedDynamicState3.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extExtendedDynamicState3); @@ -881,6 +894,7 @@ namespace dxvk { &devExtensions.extConservativeRasterization, &devExtensions.extCustomBorderColor, &devExtensions.extDepthClipEnable, + &devExtensions.extDepthBiasControl, &devExtensions.extExtendedDynamicState3, &devExtensions.extFragmentShaderInterlock, &devExtensions.extFullScreenExclusive, @@ -943,6 +957,11 @@ namespace dxvk { enabledFeatures.extDepthClipEnable.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extDepthClipEnable); } + if (devExtensions.extDepthBiasControl) { + enabledFeatures.extDepthBiasControl.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT; + enabledFeatures.extDepthBiasControl.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extDepthBiasControl); + } + if (devExtensions.extExtendedDynamicState3) { enabledFeatures.extExtendedDynamicState3.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT; enabledFeatures.extExtendedDynamicState3.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extExtendedDynamicState3); @@ -1099,6 +1118,11 @@ 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_DEPTH_BIAS_CONTROL_EXTENSION_NAME, + "\n depthBiasControl : ", features.extDepthBiasControl.depthBiasControl ? "1" : "0", + "\n leastRepresentableValueForceUnormRepresentation : ", features.extDepthBiasControl.leastRepresentableValueForceUnormRepresentation ? "1" : "0", + "\n floatRepresentation : ", features.extDepthBiasControl.floatRepresentation ? "1" : "0", + "\n depthBiasExact : ", features.extDepthBiasControl.depthBiasExact ? "1" : "0", "\n", VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME, "\n extDynamicState3AlphaToCoverageEnable : ", features.extExtendedDynamicState3.extendedDynamicState3AlphaToCoverageEnable ? "1" : "0", "\n extDynamicState3DepthClipEnable : ", features.extExtendedDynamicState3.extendedDynamicState3DepthClipEnable ? "1" : "0", diff --git a/src/dxvk/dxvk_device_info.h b/src/dxvk/dxvk_device_info.h index 2d4058f0..273a86ff 100644 --- a/src/dxvk/dxvk_device_info.h +++ b/src/dxvk/dxvk_device_info.h @@ -44,6 +44,7 @@ namespace dxvk { VkBool32 extConservativeRasterization; VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor; VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable; + VkPhysicalDeviceDepthBiasControlFeaturesEXT extDepthBiasControl; VkPhysicalDeviceExtendedDynamicState3FeaturesEXT extExtendedDynamicState3; VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT extFragmentShaderInterlock; VkBool32 extFullScreenExclusive; diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index 087221d9..68e6b91e 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -300,6 +300,7 @@ namespace dxvk { DxvkExt extConservativeRasterization = { VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extCustomBorderColor = { VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extDepthClipEnable = { VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME, DxvkExtMode::Optional }; + DxvkExt extDepthBiasControl = { VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extExtendedDynamicState3 = { VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extFullScreenExclusive = { VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt extFragmentShaderInterlock = { VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME, DxvkExtMode::Optional }; diff --git a/src/vulkan/vulkan_loader.h b/src/vulkan/vulkan_loader.h index e50d439a..5a484ad4 100644 --- a/src/vulkan/vulkan_loader.h +++ b/src/vulkan/vulkan_loader.h @@ -272,6 +272,7 @@ namespace dxvk::vk { VULKAN_FN(vkCmdSetScissor); VULKAN_FN(vkCmdSetLineWidth); VULKAN_FN(vkCmdSetDepthBias); + VULKAN_FN(vkCmdSetDepthBias2EXT); VULKAN_FN(vkCmdSetBlendConstants); VULKAN_FN(vkCmdSetDepthBounds); VULKAN_FN(vkCmdSetStencilCompareMask);