anv: CPB surfaces that are used as color attachments or for stores cannot be compressed

This particular scenario indicates that the CPB will be written to using
a fragment shader, disable compression to ensure the correct data is
read back from the surface later.

Signed-off-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20741>
This commit is contained in:
Rohan Garg 2025-02-04 17:31:23 +01:00 committed by Marge Bot
parent ceba312ebd
commit 80f9b61f02

View file

@ -235,9 +235,17 @@ anv_image_choose_isl_surf_usage(struct anv_physical_device *device,
if (vk_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)
isl_usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
if (vk_usage & VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR)
if (vk_usage & VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR) {
isl_usage |= ISL_SURF_USAGE_CPB_BIT;
/* The CPS compression scheme matches STC_CCS. So, we can allow
* compression for BLORP writes, but not for general rendering
* nor image stores.
*/
if (vk_usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_STORAGE_BIT))
isl_usage |= ISL_SURF_USAGE_DISABLE_AUX_BIT;
}
/* TODO: consider whether compression with sparse is workable. */
if (vk_create_flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT)
isl_usage |= ISL_SURF_USAGE_SPARSE_BIT |