tu: Fix corner case with clearing input attachment

If the first use of an attachment is as an input attachment, but it has
LOAD_OP_CLEAR, then we have to clear the attachment in GMEM and patch
the input attachment to refer to GMEM. Noticed by inspection.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37919>
This commit is contained in:
Connor Abbott
2025-10-08 11:54:17 -04:00
committed by Marge Bot
parent f711c3afed
commit 928e19320c

View File

@@ -417,6 +417,14 @@ tu_render_pass_patch_input_gmem(struct tu_render_pass *pass)
uint32_t a = subpass->input_attachments[j].attachment;
if (a == VK_ATTACHMENT_UNUSED)
continue;
/* Clears happen in GMEM, so we have to patch input attachments that
* are cleared to use GMEM and that requires us to invalidate UCHE to
* get the cleared value when reading as an input attachment.
*/
if (!written[a] && pass->attachments[a].clear_mask) {
written[a] = true;
subpass->feedback_invalidate = true;
}
subpass->input_attachments[j].patch_input_gmem = written[a];
}