Mesa (main): panvk: Fix stencil clears of combined ZS images

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 13 17:43:13 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jun  9 13:34:31 2022 -0400

panvk: Fix stencil clears of combined ZS images

If we have a combined Z/S image, the image has depth, so we proceed down the
depth path, which does not set clear.s even though there's *also* a stencil
component. Unify the control flow to fix this.

Fixes (among others):

dEQP-VK.api.image_clearing.core.clear_depth_stencil_image.single_layer.d24_unorm_s8_uint_multiple_subresourcerange

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16950>

---

 src/panfrost/vulkan/panvk_vX_meta_clear.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/panfrost/vulkan/panvk_vX_meta_clear.c b/src/panfrost/vulkan/panvk_vX_meta_clear.c
index eb5d2bb1fbe..c84795d25a7 100644
--- a/src/panfrost/vulkan/panvk_vX_meta_clear.c
+++ b/src/panfrost/vulkan/panvk_vX_meta_clear.c
@@ -416,6 +416,10 @@ panvk_meta_clear_zs_img(struct panvk_cmd_buffer *cmdbuf,
    *fbinfo = (struct pan_fb_info){
       .nr_samples = img->pimage.layout.nr_samples,
       .rt_count = 1,
+      .zs.clear_value.depth = value->depth,
+      .zs.clear_value.stencil = value->stencil,
+      .zs.clear.z = range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT,
+      .zs.clear.s = range->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT
    };
 
    const struct util_format_description *fdesc =
@@ -423,23 +427,14 @@ panvk_meta_clear_zs_img(struct panvk_cmd_buffer *cmdbuf,
 
    if (util_format_has_depth(fdesc)) {
       fbinfo->zs.view.zs = &view;
-      fbinfo->zs.clear.z = range->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT;
       if (util_format_has_stencil(fdesc)) {
-         fbinfo->zs.clear.s = range->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT;
          fbinfo->zs.preload.z = !fbinfo->zs.clear.z && fbinfo->zs.clear.s;
          fbinfo->zs.preload.s = !fbinfo->zs.clear.s && fbinfo->zs.clear.z;
       }
    } else {
       fbinfo->zs.view.s = &view;
-      fbinfo->zs.clear.s = range->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT;
    }
 
-   if (fbinfo->zs.clear.z)
-      fbinfo->zs.clear_value.depth = value->depth;
-
-   if (fbinfo->zs.clear.s)
-      fbinfo->zs.clear_value.stencil = value->stencil;
-
    unsigned level_count = vk_image_subresource_level_count(&img->vk, range);
    unsigned layer_count = vk_image_subresource_layer_count(&img->vk, range);
 



More information about the mesa-commit mailing list