anv: Allow MSAA resolve with different numbers of planes
authorJason Ekstrand <jason.ekstrand@collabora.com>
Sat, 12 Feb 2022 05:41:03 +0000 (23:41 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Mar 2022 22:25:42 +0000 (22:25 +0000)
commitd65dbe8018923e3a405b362c92a21caa30e66e83
treebd50e8456f3daa13af7cda2ffba631ff37b693d9
parentffd67b39e716ef6e35b75e3ba0b8391bab8bf56a
anv: Allow MSAA resolve with different numbers of planes

The Vulkan spec for VK_KHR_depth_stencil_resolve allows a format
mismatch between the primary attachment and the resolve attachment
within certain limits.  In particular,

    VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03181

    If pDepthStencilResolveAttachment is not NULL and does not have the
    value VK_ATTACHMENT_UNUSED and VkFormat of
    pDepthStencilResolveAttachment has a depth component, then the
    VkFormat of pDepthStencilAttachment must have a depth component with
    the same number of bits and numerical type

    VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182

    If pDepthStencilResolveAttachment is not NULL and does not have the
    value VK_ATTACHMENT_UNUSED, and VkFormat of
    pDepthStencilResolveAttachment has a stencil component, then the
    VkFormat of pDepthStencilAttachment must have a stencil component
    with the same number of bits and numerical type

So you can resolve from a depth/stencil format to a depth-only or
stencil-only format so long as the number of bits matches.
Unfortunately, this has never been tested because the CTS tests which
purport to test this are broken and actually test with a destination
combined depth/stencil format.

Fixes: 5e4f9ea363a6 ("anv: Implement VK_KHR_depth_stencil_resolve")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15333>
src/intel/vulkan/anv_blorp.c
src/intel/vulkan/genX_cmd_buffer.c