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@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16950>
This commit is contained in:
Alyssa Rosenzweig
2022-06-09 13:34:31 -04:00
committed by Marge Bot
parent 588ee38351
commit ec2bf34d97

View File

@@ -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);