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.
This commit is contained in:
Dean Galvin
2026-10-03 20:34:03 +13:00
parent 2596f8c0ad
commit 584c5bc590
@@ -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<std::size_t>(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;
}