perf(agc): present 8-bit integer resident images without a readback #6037
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6037"
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 meh7an on 2026-10-14T19:58:28Z.
What
ResidentPresentPathsends a resident display image in an 8-bit integer format (R8G8B8A8_UINT,B8G8R8A8_UINT) downResidentPresent::None. Every present then reads the image back from the GPU (FlushForAccesssyncs the recorder, thenGuestMemory::Read) and uploads it again (GpuColorTransfer::Upload), all under the GPU mutex.The presentation pass reads its source as raw words (
usampler2D) and decodes them by the display's format. So these images can takeResidentPresent::Convertlike the UNORM ones. A 10-bit display still takes the existing path.Sonic Origins Plus (PPSA05324) renders its final image as
R8G8B8A8_UINT. On the S2 page of its main menu, the presenter waited 270 of 5,141 samples (15 s) inRecorder::finish<-Sync<-FlushForAccess<-GuestMemory::Read, and ran 52 more in the re-upload. Meanwhile the queue worker waited on the GPU mutex for 350 samples, 5.3 per frame. With this change both are gone, and the worker's GPU-mutex waits drop to 0.2 per frame.Tested
Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.
agc_resident_presenton main5010908d6with this change. It adds two decisions: an 8-bit integer image is converted, and a 10-bit display still is not.APS5_TRACE_SECONDS=200:5on the same machine in one session, caches warm. Traces attached.The FPS shown in the title went from 4.50 to 4.77 (median of six readings).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Traces (baseline d21f225964ed, this change 910f3bc97cde):
pr6037-traces.zip
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-14T22:18:52Z.
Measured on this branch (
5b53712c7, 229 commits behind main), default CMake build (CMAKE_BUILD_TYPE empty, so unoptimized), CachyOS Linux 7.2.9,agc_driver_recorder_tests --resident-present-only, rebuilt:DisplayFormat.cpptaken from main and the new checks kept: exit 1,an 8-bit integer image is not converted. So the new decision checks fail without the change.One thing I checked because it could have been a problem: a
vkCmdBlitImagebetween an integer and a UNORM format is not allowed. This change does not use a blit for these images. By reading, for these imagesConverttakes the drawn branch: anR32_UINTview andvkCmdDraw, reading raw words as the PR body says, with novkCmdBlitImage. (A half-float display with an undrawnConvertimage does blit, butResidentPresentPathdoes not return that for these formats.)Not checked: the speedup, the Sonic Origins Plus run, anything on a real GPU or on Windows, and that an
_UINTimage actually has the usage flags theConvertpath needs. The new checks cover onlyResidentPresentPath; the suite's GPU conversion cases use no_UINTformat, and this ran on lavapipe.AI-assisted: yes