From a791c1f3a714cd54a3a97067c911bcfb5b4421f5 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 30 Nov 2020 18:54:06 +0100 Subject: [PATCH] radv: advertise VK_KHR_fragment_shading_rate on GFX10.3+ Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- docs/relnotes/new_features.txt | 1 + src/amd/vulkan/radv_device.c | 34 +++++++++++++++++++++++++++++++ src/amd/vulkan/radv_extensions.py | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index 43b5b1cf121..9a016aa2884 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -6,3 +6,4 @@ driconf: remove glx_disable_oml_sync_control, glx_disable_sgi_video_sync, and gl Removed support for loading DRI drivers older than Mesa 8.0, including all DRI1 support Add support for VK_VALVE_mutable_descriptor_type on RADV Removed classic OSMesa in favor of the newly improved gallium OSMesa +VK_KHR_fragment_shading_rate on RADV (RDNA2 only) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index b6e6f530d8e..3811c3264e3 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1466,6 +1466,14 @@ void radv_GetPhysicalDeviceFeatures2( features->mutableDescriptorType = true; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR: { + VkPhysicalDeviceFragmentShadingRateFeaturesKHR *features = + (VkPhysicalDeviceFragmentShadingRateFeaturesKHR *)ext; + features->pipelineFragmentShadingRate = true; + features->primitiveFragmentShadingRate = true; + features->attachmentFragmentShadingRate = false; /* TODO */ + break; + } default: break; } @@ -2128,6 +2136,32 @@ void radv_GetPhysicalDeviceProperties2( props->maxCustomBorderColorSamplers = RADV_BORDER_COLOR_COUNT; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR: { + VkPhysicalDeviceFragmentShadingRatePropertiesKHR *props = + (VkPhysicalDeviceFragmentShadingRatePropertiesKHR *)ext; + props->minFragmentShadingRateAttachmentTexelSize = (VkExtent2D) { 0, 0 }; + props->maxFragmentShadingRateAttachmentTexelSize = (VkExtent2D) { 0, 0 }; + props->maxFragmentShadingRateAttachmentTexelSizeAspectRatio = 0; + props->primitiveFragmentShadingRateWithMultipleViewports = true; + props->layeredShadingRateAttachments = false; + props->fragmentShadingRateNonTrivialCombinerOps = true; + props->maxFragmentSize = (VkExtent2D) { 2, 2 }; + props->maxFragmentSizeAspectRatio = 1; + props->maxFragmentShadingRateCoverageSamples = 1; + props->maxFragmentShadingRateRasterizationSamples = + VK_SAMPLE_COUNT_1_BIT | + VK_SAMPLE_COUNT_2_BIT | + VK_SAMPLE_COUNT_4_BIT | + VK_SAMPLE_COUNT_8_BIT; + props->fragmentShadingRateWithShaderDepthStencilWrites = false; + props->fragmentShadingRateWithSampleMask = true; + props->fragmentShadingRateWithShaderSampleMask = false; + props->fragmentShadingRateWithConservativeRasterization = true; + props->fragmentShadingRateWithFragmentShaderInterlock = false; + props->fragmentShadingRateWithCustomSampleLocations = true; + props->fragmentShadingRateStrictMultiplyCombiner = true; + break; + } default: break; } diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index bc4acd48c6c..7f3d8d641b3 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -78,7 +78,7 @@ EXTENSIONS = [ Extension('VK_KHR_external_semaphore', 1, 'device->rad_info.has_syncobj'), Extension('VK_KHR_external_semaphore_capabilities', 1, True), Extension('VK_KHR_external_semaphore_fd', 1, 'device->rad_info.has_syncobj'), - Extension('VK_KHR_fragment_shading_rate', 1, False), + Extension('VK_KHR_fragment_shading_rate', 1, 'device->rad_info.chip_class >= GFX10_3'), Extension('VK_KHR_get_display_properties2', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'), Extension('VK_KHR_get_memory_requirements2', 1, True), Extension('VK_KHR_get_physical_device_properties2', 1, True), -- 2.34.1