perf(agc): clear integer-format storage images with DCC code 0000 on the GPU #3865
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3865"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-11T18:10:35Z.
What
ClearColorForrefused every integer format, so a fast-cleared integer storage image (DCC keys0000) never took the GPU clear inStorageTexture::upload. It went through the CPU path instead:GuestMemory::ReadCommittedof the whole surface, which first waits for the GPU writers of that memory (the flush hook), thenFillDccClear's zero texels uploaded through a staging buffer and a waited batch.PPSA28416 (STAR WARS: Galactic Racer, UE5) fast-clears
R32_UINT,R16_UINTandR8_UINTsurfaces up to 3840x2160 every frame, from compute shaders that write the keys. Those uploads took ~14 ms each, ~1.4 s per 10 s of indirect-dispatch time.DCC code
0000is zero bits in any format (FillDccClearwrites zeros for it whatever the format), so for integer formats it now maps to a zero integer clear value. Other codes on integer formats are still refused and keep the CPU path.StorageClearAvailablefollows, so the cleared-view path of a sampled integer surface with0000keys clears as well.The two comments around the function described the old rule and are removed.
Tested
Windows 11, WinLibs GCC 15.2.0, Release, RTX 4080.
agc_*/guest_*test executables oflibSceAgcDriverbuild on Windows: all pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T00:29:47Z.
The shape of the change is right and it is the interesting part:
ClearColorForgains exactly one accepted case — an integer format withDccKeys::Clear0000→clear.uint32[0..3] = 0— and every other key on an integer format is still refused, so0000is the only case that moves off the CPU path.StorageClearAvailableis driven by the same predicate (Texture.cpp:842), so its two callers in the sampled path (ShaderResources.cpp:584,:1979) inherit the widening with no second rule to keep in sync.0000is the only safe widening: the CPU path it replaces,FillDccClear, zero-fills for that code before it looks at the format at all (DccMetadata.cpp:549), so the GPU clear and the CPU clear agree byte for byte. That equivalence, not the fps figure, is what makes the move safe.ClearColorForhas a second call site that widens with it — the keys-fill clear atTexture.cpp:3413— which runs only underAPS5_KEYS_FILL_CLEAR=1, so the default path is the upload one atTexture.cpp:1966.Coverage is the gap. No case in
tests/referencesClearColorFororStorageClearAvailable, and the existing DCC-key fixtures all use guest format 56 (8_8_8_8 UNORM —DccKeysFirstWrite.cpp:44,FillCoverKeys.cpp:39), whereClearColorForalready returned true onmain, so none of them can separate this head from the base. A case asserting that the uploaded keys areClear0000on an integer format would cover the new arm.Worth knowing when reading the checks:
linuxandwindowsare skipped on this PR, andrelinkerbuilds with-DANYPS5_RELINKER_ONLY=ON, which returns beforecore/libs— so no job that ran compiled this file. The green checks do not cover the change, and the "79 executables pass" line is local evidence.The 4.9 → 5.3 fps figure is one title on one Windows machine, and the body scopes it that way.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:27:46Z.
Checked on the PR merged onto main: the change is as described (integer formats take only DCC code
0000, a zero clear value; every other code keeps the CPU path), and the AgcDriver ctest scope passes (461/461).Added as our own commits on your branch:
Texture.hpp: removed theStorageClearAvailablecomment, which said integer formats are always refused (no longer true; comments are only for technical debt).Recorder.cpp/CMakeLists.txt: testagc_storage_integer_clearpinsStorageClearAvailableon R8/R16/R32_UINT (0000accepted,0001/1111/register/uncompressed refused). It is a registered ctest mode (--integer-clear-only) and fails without theTexture.cppchange.Merging once CI is green.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T20:29:53Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/Recorder.cppL5479