feat(agc): select storage dumps by shape and store them at each flip #3956
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3956"
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 GustavoGamarra95 on 2026-10-11T19:48:41Z.
What
APS5_DUMP_STORAGEtook only a hex address and saved the first mip of the first layer after a write-back through the CPU. Two changes:<width>x<height>x<layers>[:<format>], which selects images by shape (and guest format) for allocations whose address changes from run to run. The dump now holds the first mip of every layer or 3D slice, one plane after another, after the same three-word header (row pitch in texels, height, VkFormat).APS5_STORE_AT_FLIP=1does this for every pending image, which ran a 4 GB device out of memory at 3840x2160.The dump is still written only on the CPU write-back path; an image in host-imported memory needs
APS5_NO_HOST_IMPORT=1.Context: it dumped the 32x32x32 color-grading LUT of Beast of Reincarnation (PPSA29343), which had only slice 0 written; the cause is the dynamic rendering layer count that #3763 fixes. We are still analyzing the remaining rendering issues of that title and an improvement for GPUs with little VRAM (it runs a 4 GB RTX 3050 out of device memory at the title screen).
Tested
Linux (CachyOS, kernel 7.2), Ryzen 5 7535HS, RTX 3050 Laptop 4 GB (NVIDIA 615.78.08) and Radeon 660M (RADV), GCC, Release.
main;tools/check_conventions.pypasses.agc_driver_storage_cache_budget,agc_driver_storage_one_slice_alias,agc_driver_pending_exact_surfaceandagc_driver_image_xor_swizzle_volumepass on the RTX 3050.main) on the Radeon 660M,APS5_NO_HOST_IMPORT=1 APS5_DUMP_STORAGE=48x16x4wrote one file with 4 planes: slice 0 untouched and one band in each of slices 1 to 3, as the test expects.APS5_NO_HOST_IMPORT=1 APS5_DUMP_STORAGE=32x32x32:50dumped the LUT (32 planes).No automated test is added: it is a debug aid, inactive unless the variable is set.
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:50:03Z.
Both PRs touch
Texture.cppin the storage/texture allocation path, so reviewing together — only #4108 also touchesContext.hpp:AllocateDeviceMemoryis additive: it always makes the same first device-local attempt and returns itsVkResultunless it is exactlyVK_ERROR_OUT_OF_DEVICE_MEMORY, so every other result (success or any other error) passes through unchanged. That's a transparent substitution, not a new regression surface on the existing success path.FlushDumpSelected) runs only whenAPS5_DUMP_STORAGEis set ANDAPS5_STORE_AT_FLIPis NOT set — the two debug knobs are mutually exclusive by construction (theelseinPresentDisplayBuffer), so there's no double-flush.TextureandStorageTextureconstructors, where #3956'swriteBackLayersand the newFlushDumpSelected/dump-selector code sit roughly 2000 lines away in different functions.parsed.anyFormat = std::strchr(text, ':') == nullptr;means a shape string with a trailing colon and no format digits (e.g.512x512x1:) is read as "match format 0" instead of "match any format" — the colon is present, soanyFormatis set false even though nothing was parsed intoformat. Checking the actual field countsscanfreturns (>= 4means a format was given) rather than the presence of a colon would avoid that.BufferPool.cpptest already mocks aContextwith aVK_ERROR_OUT_OF_DEVICE_MEMORY-returning allocator, and the same mock would exerciseAllocateDeviceMemorydirectly. For #3956 it's a debug aid gated behind an env var, genuinely hard to test meaningfully in CI.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by GustavoGamarra95 on 2026-10-12T03:01:05Z.
Thanks for the review. Fixed in
bff955a: the format filter now applies only when sscanf reads all four fields, so512x512x1:matches any format, like512x512x1. Checked with512x512x1,512x512x1:,512x512x1:50and a hex address.