turnip: fix resolve MSAA D32_SFLOAT_S8_UINT image to S8_UINT

According to VK_KHR_depth_stencil_resolve spec (see
VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182):

"If the 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"

The issue with D32_SFLOAT_S8_UINT format is that it is implemented as
two planes, so we need to execute the separate_stencil path in
tu_emit_blit() to resolve its stencil component into S8_UINT image.

Fixes the following tests:

dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint.compatibility_depth_zero_stencil_zero_testing_stencil
dEQP-VK.renderpass2.depth_stencil_resolve.image_2d_32_32.samples_2.d32_sfloat_s8_uint_separate_layouts.compatibility_depth_zero_stencil_zero_testing_stencil

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8527>
This commit is contained in:
Samuel Iglesias Gonsálvez 2021-01-13 08:06:51 +00:00 committed by Marge Bot
parent 09e9be3d8f
commit 5723887676
1 changed files with 10 additions and 2 deletions

View File

@ -2551,10 +2551,18 @@ tu_store_gmem_attachment(struct tu_cmd_buffer *cmd,
(x2 % phys_dev->info.gmem_align_w && x2 != iview->extent.width) ||
y1 % phys_dev->info.gmem_align_h || (y2 % phys_dev->info.gmem_align_h && need_y2_align);
/* D32_SFLOAT_S8_UINT is quite special format: it has two planes,
* one for depth and other for stencil. When resolving a MSAA
* D32_SFLOAT_S8_UINT to S8_UINT, we need to take that into account.
*/
bool resolve_d32s8_s8 =
src->format == VK_FORMAT_D32_SFLOAT_S8_UINT &&
dst->format == VK_FORMAT_S8_UINT;
/* use fast path when render area is aligned, except for unsupported resolve cases */
if (!unaligned && (a == gmem_a || blit_can_resolve(dst->format))) {
if (dst->store)
tu_emit_blit(cmd, cs, iview, src, true, false);
tu_emit_blit(cmd, cs, iview, src, true, resolve_d32s8_s8);
if (dst->store_stencil)
tu_emit_blit(cmd, cs, iview, src, true, true);
return;
@ -2575,7 +2583,7 @@ tu_store_gmem_attachment(struct tu_cmd_buffer *cmd,
format = VK_FORMAT_D32_SFLOAT;
if (dst->store) {
store_cp_blit(cmd, cs, iview, src->samples, false, format,
store_cp_blit(cmd, cs, iview, src->samples, resolve_d32s8_s8, format,
src->gmem_offset, src->cpp);
}
if (dst->store_stencil) {