From 43f53f3c0e4e37c47c0f4f6136d21477daffa87f Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 5 Aug 2022 19:07:01 +0000 Subject: [PATCH] [dxvk] Enable VK_EXT_attachment_feedback_loop_layout if available --- src/dxvk/dxvk_adapter.cpp | 17 ++++++++++++++++- src/dxvk/dxvk_device_info.h | 1 + src/dxvk/dxvk_extensions.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/dxvk/dxvk_adapter.cpp b/src/dxvk/dxvk_adapter.cpp index 42514ebd..11982556 100644 --- a/src/dxvk/dxvk_adapter.cpp +++ b/src/dxvk/dxvk_adapter.cpp @@ -244,6 +244,8 @@ namespace dxvk { || !required.vk13.dynamicRendering) && (m_deviceFeatures.vk13.maintenance4 || !required.vk13.maintenance4) + && (m_deviceFeatures.extAttachmentFeedbackLoopLayout.attachmentFeedbackLoopLayout + || !required.extAttachmentFeedbackLoopLayout.attachmentFeedbackLoopLayout) && (m_deviceFeatures.extCustomBorderColor.customBorderColors || !required.extCustomBorderColor.customBorderColors) && (m_deviceFeatures.extCustomBorderColor.customBorderColorWithoutFormat @@ -283,9 +285,10 @@ namespace dxvk { DxvkDeviceFeatures enabledFeatures) { DxvkDeviceExtensions devExtensions; - std::array devExtensionList = {{ + std::array devExtensionList = {{ &devExtensions.amdMemoryOverallocationBehaviour, &devExtensions.amdShaderFragmentMask, + &devExtensions.extAttachmentFeedbackLoopLayout, &devExtensions.extConservativeRasterization, &devExtensions.extCustomBorderColor, &devExtensions.extDepthClipEnable, @@ -403,6 +406,11 @@ namespace dxvk { enabledFeatures.vk13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; enabledFeatures.vk13.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.vk13); + if (devExtensions.extAttachmentFeedbackLoopLayout) { + enabledFeatures.extAttachmentFeedbackLoopLayout.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; + enabledFeatures.extAttachmentFeedbackLoopLayout.pNext = std::exchange(enabledFeatures.core.pNext, &enabledFeatures.extAttachmentFeedbackLoopLayout); + } + 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); @@ -681,6 +689,11 @@ namespace dxvk { m_deviceFeatures.vk13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES; m_deviceFeatures.vk13.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.vk13); + if (m_deviceExtensions.supports(VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME)) { + m_deviceFeatures.extAttachmentFeedbackLoopLayout.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT; + m_deviceFeatures.extAttachmentFeedbackLoopLayout.pNext = std::exchange(m_deviceFeatures.core.pNext, &m_deviceFeatures.extAttachmentFeedbackLoopLayout); + } + 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); @@ -811,6 +824,8 @@ namespace dxvk { "\n synchronization2 : ", features.vk13.synchronization2, "\n dynamicRendering : ", features.vk13.dynamicRendering, "\n maintenance4 : ", features.vk13.maintenance4, + "\n", VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME, + "\n attachmentFeedbackLoopLayout : ", features.extAttachmentFeedbackLoopLayout.attachmentFeedbackLoopLayout ? "1" : "0", "\n", VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, "\n customBorderColors : ", features.extCustomBorderColor.customBorderColors ? "1" : "0", "\n customBorderColorWithoutFormat : ", features.extCustomBorderColor.customBorderColorWithoutFormat ? "1" : "0", diff --git a/src/dxvk/dxvk_device_info.h b/src/dxvk/dxvk_device_info.h index d8bc9ffd..212bd69c 100644 --- a/src/dxvk/dxvk_device_info.h +++ b/src/dxvk/dxvk_device_info.h @@ -39,6 +39,7 @@ namespace dxvk { VkPhysicalDeviceVulkan11Features vk11; VkPhysicalDeviceVulkan12Features vk12; VkPhysicalDeviceVulkan13Features vk13; + VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT extAttachmentFeedbackLoopLayout; VkPhysicalDeviceCustomBorderColorFeaturesEXT extCustomBorderColor; VkPhysicalDeviceDepthClipEnableFeaturesEXT extDepthClipEnable; VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT extGraphicsPipelineLibrary; diff --git a/src/dxvk/dxvk_extensions.h b/src/dxvk/dxvk_extensions.h index ffc7c373..c9d9030e 100644 --- a/src/dxvk/dxvk_extensions.h +++ b/src/dxvk/dxvk_extensions.h @@ -278,6 +278,7 @@ namespace dxvk { struct DxvkDeviceExtensions { DxvkExt amdMemoryOverallocationBehaviour = { VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME, DxvkExtMode::Optional }; DxvkExt amdShaderFragmentMask = { VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME, DxvkExtMode::Optional }; + DxvkExt extAttachmentFeedbackLoopLayout = { VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME, DxvkExtMode::Optional }; 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 };