From 91505132423bcf8949034ef277b8bee4e1936855 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 6 May 2022 13:58:48 +0200 Subject: [PATCH] radv: advertise VK_KHR_fragment_shader_barycentric on GFX10.3+ It can't be supported on older hardware because it's impossible to determine the provoking vertex ID without LOAD_PROVOKING_VTX which is GFX10.3+ only. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6557 Signed-off-by: Samuel Pitoiset Part-of: --- docs/features.txt | 1 + docs/relnotes/new_features.txt | 1 + src/amd/ci/external/radv-gfx1100-aco-fails.txt | 7 ++++++- src/amd/ci/radv-navi21-aco-fails.txt | 7 +++++++ src/amd/ci/radv-vangogh-aco-fails.txt | 7 +++++++ src/amd/vulkan/radv_physical_device.c | 10 ++++++++++ src/amd/vulkan/radv_shader.c | 1 + 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/features.txt b/docs/features.txt index 2c543ec0a88..3c88eef860c 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -512,6 +512,7 @@ Khronos extensions that are not part of any Vulkan version: VK_KHR_external_memory_win32 DONE (dzn) VK_KHR_external_semaphore_fd DONE (anv, dzn, radv, tu, v3dv, vn) VK_KHR_external_semaphore_win32 DONE (dzn) + VK_KHR_fragment_shader_barycentric DONE (radv/gfx10.3+) VK_KHR_fragment_shading_rate DONE (anv/gen11+, radv/gfx10.3+) VK_KHR_get_display_properties2 DONE (anv, radv, tu, v3dv) VK_KHR_get_surface_capabilities2 DONE (anv, lvp, radv, tu, v3dv, vn) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index f0b0ade93fa..0d53cfde1d2 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -4,3 +4,4 @@ VK_EXT_dynamic_rendering_unused_attachments on RADV VK_EXT_mesh_shader on lavapipe OpenGL 3.1 on Asahi OpenGL ES 3.0 on Asahi +VK_KHR_fragment_shader_barycentric on RADV/GFX10.3+ diff --git a/src/amd/ci/external/radv-gfx1100-aco-fails.txt b/src/amd/ci/external/radv-gfx1100-aco-fails.txt index 8b137891791..12851ba3260 100644 --- a/src/amd/ci/external/radv-gfx1100-aco-fails.txt +++ b/src/amd/ci/external/radv-gfx1100-aco-fails.txt @@ -1 +1,6 @@ - +# Test bug https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4498 +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_fan.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list_with_adjacency.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip_with_adjacency.perspective,Fail diff --git a/src/amd/ci/radv-navi21-aco-fails.txt b/src/amd/ci/radv-navi21-aco-fails.txt index 594fe330ac1..c541f51c5a7 100644 --- a/src/amd/ci/radv-navi21-aco-fails.txt +++ b/src/amd/ci/radv-navi21-aco-fails.txt @@ -2,3 +2,10 @@ dEQP-VK.pipeline.fast_linked_library.extended_dynamic_state.before_draw.line_stipple_enable,Fail dEQP-VK.subgroups.builtin_var.ray_tracing.subgroupsize,Fail + +# Test bug https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4498 +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_fan.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list_with_adjacency.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip_with_adjacency.perspective,Fail diff --git a/src/amd/ci/radv-vangogh-aco-fails.txt b/src/amd/ci/radv-vangogh-aco-fails.txt index 85e16a6d1e5..4f9d6777379 100644 --- a/src/amd/ci/radv-vangogh-aco-fails.txt +++ b/src/amd/ci/radv-vangogh-aco-fails.txt @@ -4,3 +4,10 @@ dEQP-VK.binding_model.ics_miss_buffers8_sets1,Crash dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.linear_interpolation.no_offset_2_samples,Fail dEQP-VK.subgroups.builtin_var.ray_tracing.subgroupsize,Fail + +# Test bug https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/4498 +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_fan.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_list_with_adjacency.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip.perspective,Fail +dEQP-VK.fragment_shading_barycentric.weights.pipeline_topology_dynamic.msaa_interpolate_at_offset.triangle_strip_with_adjacency.perspective,Fail diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 43796ab3202..d62acf2792b 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -416,6 +416,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .KHR_external_semaphore = true, .KHR_external_semaphore_fd = true, .KHR_format_feature_flags2 = true, + .KHR_fragment_shader_barycentric = device->rad_info.gfx_level >= GFX10_3, .KHR_fragment_shading_rate = device->rad_info.gfx_level >= GFX10_3, .KHR_get_memory_requirements2 = true, .KHR_global_priority = true, @@ -1034,6 +1035,9 @@ radv_physical_device_get_features(const struct radv_physical_device *pdevice, /* VK_EXT_dynamic_rendering_unused_attachments */ .dynamicRenderingUnusedAttachments = true, + + /* VK_KHR_fragment_shader_barycentric */ + .fragmentShaderBarycentric = true, }; } @@ -1853,6 +1857,12 @@ radv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, properties->descriptorBufferAddressSpaceSize = RADV_MAX_MEMORY_ALLOCATION_SIZE; break; } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR: { + VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR *properties = + (VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR *)ext; + properties->triStripVertexOrderIndependentOfProvokingVertex = false; + break; + } default: break; } diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index be2a6cbcf1b..bce858290a0 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -402,6 +402,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_pipeline_ .float32_atomic_min_max = true, .float64 = true, .float64_atomic_min_max = true, + .fragment_barycentric = true, .fragment_fully_covered = true, .geometry_streams = true, .groups = true,