perf(agc): bind misaligned draw buffer regions in place through the view adjustment #2176
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2176"
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 oneandonlydean on 2026-10-09T10:41:56Z.
What
A draw build that is not address-based and whose every guest buffer element has a memory offset slot (a push constant byte, or a shader data byte inside its data buffer) binds a region whose offset in its host import is DWORD aligned in place (
GuestBufferMemory::AllowAdjustedRegions,bindableInPlace), like a region atminStorageBufferOffsetAlignment:Descriptorbinds the view from the aligned offset below it and the shader gets the remainder through its memory offset slot, as it already does for misaligned views;PrepareDrawBindingsataddress - adjustment;Revalidateproves it per use, as for aligned regions.Dispatches keep the copy: they read in-place inputs at execution, not at record.
Why
Such a region was copied per build: a new buffer, an input snapshot, and a
vkCmdCopyBufferthat ends the open render pass.DirectRegionsalso refused the build as a template. In the level measured below, binding them in place more than doubles the draws that continue an open render pass.Tested
Linux (CachyOS, GCC 16.2, RTX 4090, NVIDIA 610.57), on
maina8b032b236: ctest 495/495.tools/check_conventions.pypasses.agc_driver_recorder_tests, newmisalignedRegionTests: a misaligned read-only draw region is read in place and the build is reusable (onmainit is copied and the check fails); the push constant carries the adjustment; the per-draw snapshot starts at the aligned offset below the view and holds the view's bytes after a CPU store. ctest builds this executable but does not run it; run by hand, it passesmisalignedRegionTestsand stops later atimportWindowTests"(w) a cache over the pages the import reported sees no change", which fails the same way onmain.A heavier title, one level, frames per second over level start +30 to +150 s, warm caches, two runs with the change and four of the base. It does not reach the level on
mainalone, so this was measured with the fixes needed for the title to reach the level:main4b6ab6bb73plus the boot fixes, #425 (with a depth-plane read fix), #1274, #1745, #1059 and an import budget like #290's. The base is that build:Graphics::Drawper draw packetLevel frames show the same scene, geometry and brightness as the base.
A lighter title that runs at 60 fps: unchanged, 60.0 fps menu, 59.9 fps gameplay, no skipped draws, all screen checks 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 rmz-24 on 2026-10-09T12:38:41Z.
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build pluslibs.ac2d172echerry-picked onto currentmaind70b8998(applies cleanly).agc_driver_recorder_testsrun directly:misalignedRegionTestsruns on this host (no "not tested" message, host imports available,minStorageBufferOffsetAlignmentin range) and passes. The suite then stops later at the refresh-store assertion thatmainalso hits on Windows (#2155), which this change doesn't touch.AI-assisted: yes