Mesa (main): anv: Don't assume depth/stencil attachments have depth

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 16 23:31:48 UTC 2022


Module: Mesa
Branch: main
Commit: df0e2a1565587cec47a8074f0d4a597e21e99783
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df0e2a1565587cec47a8074f0d4a597e21e99783

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Wed Feb 16 14:51:21 2022 -0600

anv: Don't assume depth/stencil attachments have depth

If a secondary command buffer is used and the client provides a
framebuffer and that framebuffer has a stencil-only attchment, we would
try to get the aux usage for the depth component of that attachment and
crash.  Check the aspects of the image before looking at aux usage.
This fixes at least the following SkQP tests on my Tigerlake:

 - vk_circular-clips
 - vk_filterfastbounds
 - vk_innershapes_bw
 - vk_lineclosepath
 - vk_multipicturedraw_rrectclip_simple
 - vk_pathinvfill
 - vk_quadclosepath
 - vk_rrect_clip_bw
 - vk_windowrectangles

Fixes: 0d8b9c529ce3 ("anv: Allow PMA optimization to be enabled in secondary command buffers")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Tested-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15048>

---

 src/intel/vulkan/genX_cmd_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index df791bb8f72..f8aab6ac80d 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1873,7 +1873,7 @@ genX(BeginCommandBuffer)(
             const struct anv_image_view * const iview =
                anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
 
-            if (iview) {
+            if (iview && (iview->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT)) {
                VkImageLayout layout =
                   cmd_buffer->state.subpass->depth_stencil_attachment->layout;
 



More information about the mesa-commit mailing list