From 584c5bc590463adce01e4a134bcfeda85ce21c7e Mon Sep 17 00:00:00 2001 From: Dean Galvin Date: Sat, 3 Oct 2026 20:34:03 +1300 Subject: [PATCH] perf(agc): wait for a pending key fill before materializing a register DCC clear The first draw into a target whose DCC keys hold the register clear code materializes the clear. The GPU clear of the resident image refuses while a recorded write to the keys is still pending, so whenever the title's own key fill had not run yet the clear went the CPU way: the clear texels stored into guest memory (16 MiB for PPSA21564's normal G-buffer) and the image uploaded again. With the occlusion dumps no longer draining the device, the fill is usually still pending at that draw, and that was every frame of PPSA21564's level. The draw now waits for the recorded writes of the key range alone, checks the keys again, and clears on the GPU when they still hold the register code, as it did when the fill had already landed. --- core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp index cbad1d34d..3d9239d39 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp @@ -107,7 +107,17 @@ void materializeRegisterClear(const Context& context, const ColorTarget& color, if (CurrentDccKeys(color.dccAddress, color.bytes) != DccKeys::ClearRegister) return; const auto texel = clearTexel(color, DccKeys::ClearRegister); const char* refusal = nullptr; - if (clearToTexel(resident, texel, color.elementBytes, refusal)) { + bool cleared = clearToTexel(resident, texel, color.elementBytes, refusal); + const auto keyBytes = static_cast(color.bytes / 256); + if (!cleared && keyBytes != 0) { + if (auto* recorder = Recorder::Active(); recorder != nullptr && recorder->PendingWriteOverlaps(color.dccAddress, keyBytes)) { + Recorder::CountSync(2); + recorder->SyncThrough(color.dccAddress, keyBytes); + if (CurrentDccKeys(color.dccAddress, color.bytes) != DccKeys::ClearRegister) return; + cleared = clearToTexel(resident, texel, color.elementBytes, refusal); + } + } + if (cleared) { MarkDccUncompressed(context, color.dccAddress, color.bytes); return; }