Module: Mesa Branch: main Commit: 1ef5feac5ef48515bba2fa22c8a2a4e517739519 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ef5feac5ef48515bba2fa22c8a2a4e517739519
Author: Samuel Pitoiset <samuel.pitoi...@gmail.com> Date: Tue Dec 12 14:55:29 2023 +0100 radv: fix binding partial depth/stencil views with dynamic rendering With dynamic rendering, it's allowed to begin rendering with depth or stencil only but still with a depth/stencil format. The test below checks that unbound part of ds isn't modified, if depth is bound and stencil not and vice versa. This fixes a recent CTS dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil. Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25350> --- src/amd/ci/radv-navi10-aco-fails.txt | 1 - src/amd/ci/radv-navi21-aco-flakes.txt | 1 - src/amd/ci/radv-navi31-aco-fails.txt | 1 - src/amd/ci/radv-polaris10-aco-fails.txt | 1 - src/amd/ci/radv-renoir-aco-fails.txt | 1 - src/amd/ci/radv-vangogh-aco-flakes.txt | 3 --- src/amd/ci/radv-vega10-aco-flakes.txt | 3 --- src/amd/vulkan/radv_cmd_buffer.c | 12 +++++++++++- src/amd/vulkan/radv_device.c | 6 ++++-- src/amd/vulkan/radv_private.h | 2 +- 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/amd/ci/radv-navi10-aco-fails.txt b/src/amd/ci/radv-navi10-aco-fails.txt index 2967a976f05..acda34d6cf2 100644 --- a/src/amd/ci/radv-navi10-aco-fails.txt +++ b/src/amd/ci/radv-navi10-aco-fails.txt @@ -1,3 +1,2 @@ # New CTS failures in 1.3.7.0 dEQP-VK.api.version_check.unavailable_entry_points,Fail -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil,Fail diff --git a/src/amd/ci/radv-navi21-aco-flakes.txt b/src/amd/ci/radv-navi21-aco-flakes.txt index 6e435877db2..a0210283aab 100644 --- a/src/amd/ci/radv-navi21-aco-flakes.txt +++ b/src/amd/ci/radv-navi21-aco-flakes.txt @@ -14,6 +14,5 @@ dEQP-VK.pipeline.*line_stipple_params # New CTS flakes in 1.3.6.3 dEQP-VK.ray_tracing_pipeline.pipeline_library.configurations.(single|multi)threaded_compilation.*_check_(all|capture_replay)_handles -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil dEQP-VK.query_pool.statistics_query.host_query_reset.geometry_shader_invocations.secondary.32bits_triangle_list_clear_depth diff --git a/src/amd/ci/radv-navi31-aco-fails.txt b/src/amd/ci/radv-navi31-aco-fails.txt index 2967a976f05..acda34d6cf2 100644 --- a/src/amd/ci/radv-navi31-aco-fails.txt +++ b/src/amd/ci/radv-navi31-aco-fails.txt @@ -1,3 +1,2 @@ # New CTS failures in 1.3.7.0 dEQP-VK.api.version_check.unavailable_entry_points,Fail -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil,Fail diff --git a/src/amd/ci/radv-polaris10-aco-fails.txt b/src/amd/ci/radv-polaris10-aco-fails.txt index 9ed35ee6c8d..c07d22fe8fc 100644 --- a/src/amd/ci/radv-polaris10-aco-fails.txt +++ b/src/amd/ci/radv-polaris10-aco-fails.txt @@ -20,4 +20,3 @@ dEQP-VK.texture.mipmap.cubemap.image_view_min_lod.base_level.nearest_nearest,Fai # New CTS failures in 1.3.7.0. dEQP-VK.api.version_check.unavailable_entry_points,Fail -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil,Fail diff --git a/src/amd/ci/radv-renoir-aco-fails.txt b/src/amd/ci/radv-renoir-aco-fails.txt index e37b1a769a6..a91278246ec 100644 --- a/src/amd/ci/radv-renoir-aco-fails.txt +++ b/src/amd/ci/radv-renoir-aco-fails.txt @@ -1,3 +1,2 @@ # New CTS failures in 1.3.7.0. dEQP-VK.api.version_check.unavailable_entry_points,Fail -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil,Fail diff --git a/src/amd/ci/radv-vangogh-aco-flakes.txt b/src/amd/ci/radv-vangogh-aco-flakes.txt index 52105689121..61d3f90e86e 100644 --- a/src/amd/ci/radv-vangogh-aco-flakes.txt +++ b/src/amd/ci/radv-vangogh-aco-flakes.txt @@ -3,6 +3,3 @@ dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.* dEQP-VK.draw.dynamic_rendering.* dEQP-VK.pipeline.monolithic.image.suballocation.sampling_type.separate.view_type.2d_array.format.r4g4b4a4_unorm_pack16.count_4.size.32x16_array_of_6 - -# New flakes in CTS 1.3.7.0 -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil diff --git a/src/amd/ci/radv-vega10-aco-flakes.txt b/src/amd/ci/radv-vega10-aco-flakes.txt index 8d00ad7dedb..cb85ff27204 100644 --- a/src/amd/ci/radv-vega10-aco-flakes.txt +++ b/src/amd/ci/radv-vega10-aco-flakes.txt @@ -14,6 +14,3 @@ dEQP-VK.multiview.multisample.get_query_pool_results.* dEQP-VK.*framebuffer_attachment.diff_attachments.* dEQP-VK.*framebuffer_attachment.multi_attachments_not_exported_2d.* dEQP-VK.*framebuffer_attachment.resolve_input_same_attachment - -# New flakes in CTS 1.3.7.0 -dEQP-VK.dynamic_rendering.primary_cmd_buff.basic.partial_binding_depth_stencil diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index b6c4bd16f4e..5532b7c3121 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -7664,7 +7664,17 @@ radv_CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRe assert(d_iview == NULL || s_iview == NULL || d_iview == s_iview); ds_att.iview = d_iview ? d_iview : s_iview, ds_att.format = ds_att.iview->vk.format; - radv_initialise_ds_surface(cmd_buffer->device, &ds_att.ds, ds_att.iview); + + VkImageAspectFlags ds_aspects; + if (d_iview && s_iview) { + ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; + } else if (d_iview) { + ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT; + } else { + ds_aspects = VK_IMAGE_ASPECT_STENCIL_BIT; + } + + radv_initialise_ds_surface(cmd_buffer->device, &ds_att.ds, ds_att.iview, ds_aspects); assert(d_res_iview == NULL || s_res_iview == NULL || d_res_iview == s_res_iview); ds_att.resolve_iview = d_res_iview ? d_res_iview : s_res_iview; diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 60e00ff45e9..9122263dbe1 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1881,7 +1881,7 @@ radv_initialise_vrs_surface(struct radv_image *image, struct radv_buffer *htile_ void radv_initialise_ds_surface(const struct radv_device *device, struct radv_ds_buffer_info *ds, - struct radv_image_view *iview) + struct radv_image_view *iview, VkImageAspectFlags ds_aspects) { unsigned level = iview->vk.base_mip_level; unsigned format, stencil_format; @@ -1898,7 +1898,9 @@ radv_initialise_ds_surface(const struct radv_device *device, struct radv_ds_buff stencil_format = surf->has_stencil ? V_028044_STENCIL_8 : V_028044_STENCIL_INVALID; uint32_t max_slice = radv_surface_max_layer_count(iview) - 1; - ds->db_depth_view = S_028008_SLICE_START(iview->vk.base_array_layer) | S_028008_SLICE_MAX(max_slice); + ds->db_depth_view = S_028008_SLICE_START(iview->vk.base_array_layer) | S_028008_SLICE_MAX(max_slice) | + S_028008_Z_READ_ONLY(!(ds_aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) | + S_028008_STENCIL_READ_ONLY(!(ds_aspects & VK_IMAGE_ASPECT_STENCIL_BIT)); if (device->physical_device->rad_info.gfx_level >= GFX10) { ds->db_depth_view |= S_028008_SLICE_START_HI(iview->vk.base_array_layer >> 11) | S_028008_SLICE_MAX_HI(max_slice >> 11); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 021d337b533..696daa98f31 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1546,7 +1546,7 @@ struct radv_ds_buffer_info { void radv_initialise_color_surface(struct radv_device *device, struct radv_color_buffer_info *cb, struct radv_image_view *iview); void radv_initialise_ds_surface(const struct radv_device *device, struct radv_ds_buffer_info *ds, - struct radv_image_view *iview); + struct radv_image_view *iview, VkImageAspectFlags ds_aspects); void radv_initialise_vrs_surface(struct radv_image *image, struct radv_buffer *htile_buffer, struct radv_ds_buffer_info *ds);