From ec2bf34d97d31225ae7727dd6dfa2dabe54e6d8b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 9 Jun 2022 13:34:31 -0400 Subject: [PATCH] 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 Reviewed-by: Boris Brezillon Part-of: --- 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);