From cdaa3a899cf08858274a79d4c806f26881bead31 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 17 Mar 2022 17:35:27 -0500 Subject: [PATCH] anv: Use layerCount for clears and transitions in BeginRendering The Vulkan spec was recently clerified to say that transitions only happen to the bound layers: "Automatic layout transitions apply to the entire image subresource attached to the framebuffer. If multiview is not enabled and the attachment is a view of a 1D or 2D image, the automatic layout transitions apply to the number of layers specified by VkFramebufferCreateInfo::layers. If multiview is enabled and the attachment is a view of a 1D or 2D image, the automatic layout transitions apply to the layers corresponding to views which are used by some subpass in the render pass, even if that subpass does not reference the given attachment." This is in the context of render passes but it applies to dynamic rendering because the implicit layout transition stuff is a Mesa pseudo- extension and inherits those rules. For clears, the Vulkan spec says: "renderArea is the render area that is affected by the render pass instance. The effects of attachment load, store and multisample resolve operations are restricted to the pixels whose x and y coordinates fall within the render area on all attachments. The render area extends to all layers of framebuffer." Again, this is in the context of render passes but the same principals apply to dynamic rendering where the layerCount and renderArea are specified as part of the vkCmdBeginRendering() call. Fixes: 3501a3f9ed92 ("anv: Convert to 100% dynamic rendering") Reviewed-by: Ivan Briano Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 9aa0ab2c8e9..2f88ed8d928 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -6595,7 +6595,7 @@ void genX(CmdBeginRendering)( VK_IMAGE_ASPECT_COLOR_BIT, iview->vk.base_mip_level, 1, iview->vk.base_array_layer, - iview->vk.layer_count, + gfx->layer_count, initial_layout, att->imageLayout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED, @@ -6605,7 +6605,7 @@ void genX(CmdBeginRendering)( uint32_t clear_view_mask = pRenderingInfo->viewMask; uint32_t base_clear_layer = iview->vk.base_array_layer; - uint32_t clear_layer_count = iview->vk.layer_count; + uint32_t clear_layer_count = gfx->layer_count; if (fast_clear) { /* We only support fast-clears on the first layer */ assert(iview->vk.base_mip_level == 0 && @@ -6812,7 +6812,7 @@ void genX(CmdBeginRendering)( } else { transition_depth_buffer(cmd_buffer, d_iview->image, d_iview->vk.base_array_layer, - d_iview->vk.layer_count, + gfx->layer_count, initial_depth_layout, depth_layout, hiz_clear); } @@ -6837,7 +6837,7 @@ void genX(CmdBeginRendering)( transition_stencil_buffer(cmd_buffer, s_iview->image, s_iview->vk.base_mip_level, 1, s_iview->vk.base_array_layer, - s_iview->vk.layer_count, + gfx->layer_count, initial_stencil_layout, stencil_layout, hiz_clear); @@ -6871,7 +6871,7 @@ void genX(CmdBeginRendering)( } else { uint32_t level = ds_iview->vk.base_mip_level; uint32_t base_layer = ds_iview->vk.base_array_layer; - uint32_t layer_count = ds_iview->vk.layer_count; + uint32_t layer_count = gfx->layer_count; if (hiz_clear) { anv_image_hiz_clear(cmd_buffer, ds_iview->image,