anv: Fix needs_temp_copy() incorrectly matching depth/stencil formats

The needs_temp_copy() function was incorrectly identifying some
depth/stencil formats as needing RGB<->RGBA conversion.

VK_FORMAT_D32_SFLOAT_S8_UINT maps to PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
which has 3 channels (F32 depth, UP8 stencil, X24 padding). The
component count check (== 3) was matching this as an RGB color format,
causing depth/stencil images to incorrectly use the RGB conversion path.

Add an explicit vk_format_is_depth_or_stencil() check before the
component count test to ensure depth/stencil formats always use the
direct copy path.

Fixes: f97b51186f ("anv: intermediate RGB <-> RGBX copy for HIC")
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37691>
This commit is contained in:
Christian Gmeiner 2025-10-28 11:00:35 +01:00 committed by Marge Bot
parent bbaaf2fec7
commit 0be53b2ed8

View file

@ -207,6 +207,10 @@ needs_temp_copy(struct anv_image *image, VkHostImageCopyFlags flags)
flags & VK_HOST_IMAGE_COPY_MEMCPY_BIT)
return false;
/* Skip depth/stencil formats */
if (vk_format_is_depth_or_stencil(image->vk.format))
return false;
return util_format_get_nr_components(vk_format_to_pipe_format(image->vk.format)) == 3;
}