From 928e19320cdc7394aabf69a946a87be9e663de82 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 8 Oct 2025 11:54:17 -0400 Subject: [PATCH] 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: --- src/freedreno/vulkan/tu_pass.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/freedreno/vulkan/tu_pass.cc b/src/freedreno/vulkan/tu_pass.cc index 09f8d6a0f6d..8bc0901498b 100644 --- a/src/freedreno/vulkan/tu_pass.cc +++ b/src/freedreno/vulkan/tu_pass.cc @@ -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]; }