fix(agc): skip storage write-back units that lie in no tiled slice #7912
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7912"
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 Rajkamalcode on 2026-10-19T13:21:45Z.
What
Fixes a fatal crash on any title that keeps a thin 3D storage texture:
[videoout] presentation failed: ... AGC graphics: zero-sized device buffer, then[gpu] driver failureandFATAL: abort(). Squirrel With A Gun (PPSA22102) hit it in every run, seconds after its first frames at the logo transition.StorageTexture::writeBackWindowsretiles the kept 64 KiB tracking units through the (layer, mip) windows of the surface's tiled slices, and sizes itslinearandscratchstaging buffers from them. A kept unit can lie outside every window: the tracking grid is flat over the guest range (trackedLayers = ceil(guestBytes / 64K)), while the slices of a 3D surface taper in depth with the mip level (SurfaceGeometry::HasLayer). The empty window list then sized both staging buffers at zero, and theDeviceBufferconstructor threwzero-sized device buffer(Resources.cpp).The crashing texture, from the run 4 probe: 160x160, six mips, 160 depth slices, SW_64KB_R_X, 60 MiB, 960 tracked units:
The run 5 probe prints the kept run and the slice map when the window list comes back empty; the run is layer 156's mip-1 block, which
HasLayerdoes not keep:The fix keeps such units as the guest left them: there is no tiled data of the surface to retile or store, and the caller alone accounts for them (units partially covered by a window are already clamped per window). Five lines. The remaining gap - the flat unit grid against the per-level taper - is recorded in the library's technical debt.
Tested
Squirrel With A Gun, PPSA22102.
main034c4ec3b(run 6) andf3bb6a4f8(tests); this PR 4eb97812b, rebased as 52d73deda. The in-game run used the same guard (4eb97812b); the rebase only adds the regression test, shortens the comment and adds the debt note.Selected GPU name=NVIDIA GeForce RTX 3070 vendor=0x10de device=0x2484 subgroup=32, driver 32.0.16.1088, desktop at 60 Hz.cd games\SquirrelWithAGun; .\SquirrelWithAGun.exe(the title's UE5 arguments come fromapp0/uecommandline.txt), noAPS5_*/ANYPS5_*variables set, warmshader_cache/. The title's stored settings ask for 3840x2160 windowed; the crashing runs and run 6 used them.0xc0000409,FATAL: abort()); then one run with the fix, which passes the transition, presents the menu and shows no crash marker until it was stopped by hand. Presents per 10 s were not logged (APS5_PROFILE_DRAWunset); the title's own counter read 41-58 FPS in earlier runs.agc_driver_storage_write_back_no_window(tests/execution/StorageWriteBackNoWindow.cpp): a thin 3D volume whose taper leaves 8 of 32 tracked units outside every window. Red/green on the same machine: withTexture.cppatmainit fails with the sameAGC graphics: zero-sized device buffer; with the fix it passes, checking as well that every flush settles the image and that the outside-window units leave their guest bytes untouched.ctestsuite on the same machine (serial,--output-on-failure): 1666 tests, 3 failures, all accounted for:guest_errandguest_mathfail onmainon Windows and are fixed by the two open PRs #7905 and #7906;agc_driver_pass_input_hazardalso failed with this PR'sTexture.cppchange reverted (measured on the previous base; it exercises the in-place draw-input copy path on NVIDIA Windows, not the storage write-back). Everything else passed, includingagc_driver_storage_write_back_no_window.Date: 2026-10-19.
Checklist
main; no other open PR implements the same functionsdocs/dev/debt/libSceAgcDriver.md)NotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by Rajkamalcode on 2026-10-19T13:21:47Z.
Attaching the investigation notes behind the report; the probes were temporary and are not part of this PR.
Where the zero size comes from. A debug print in the
DeviceBufferconstructor (only whensize == 0) plus a module-relative stack scan, mapped through the module symbols, landed inStorageTexture::writeBackWindowsat thelinearstaging buffer (frame 0 RVA+0x1d8b53oflibSceAgcDriver.prxmaps toTexture.cppwriteBackWindows):Why the window list is empty. A second probe prints the kept run and the full slice map when
sliceWindowscomes back empty:The kept 64 KiB run is exactly
L156 M1's block, andhas=0there:HasLayer(1, 156)is false (layer < max(imgDepth >> level, 1)is156 < 80) while the flat 64 KiB unit grid counted 960 units over the whole 60 MiB. Every other kept unit in the dump sits inside a kept slice.Regression test, red/green (Windows 11, MinGW-w64 GCC 15.2.0, RTX 3070):
The full run logs (runs 1-6) and the red/green
ctestoutputs can be attached on request.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T13:38:27Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:39:22Z.
Review: COMMENTED
Coordination note for #8638: its new doc-link scan finds this same edited debt entry as the sole tracked Markdown dead link. The target currently says
Execution/src/Driver/Draw/DrawPipeline.hpp; the header is atcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp. Since this PR changes the entry, could you correct that target here so the changed line passes once #8638 lands?Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-21T06:05:24Z.
Independent post-merge component check:
agc_driver_storage_write_back_no_windowpasses 3/3 fresh processes on each RTX5080 and AMD gfx1036. Every run checks 32 units, eight outside every tiled window, with the sentinel bytes preserved and no pending image left.No skips/timeouts/VUIDs/validation errors. Ten
WARNING-VkImageSubresourceRange-layerCount-compatibilitywarnings per process (60 total): the 3D-image barrier uses layerCount1 with maintenance9 disabled; the layer recommendsVK_REMAINING_ARRAY_LAYERSfor forward compatibility. All warnings are retained; this is not validation-warning-free. The harness initially stopped on that warning count after a successful first run; that result was retained and only the remaining planned cells were executed.Windows 11 Enterprise 26200, WinLibs GCC15.2.0 r7/UCRT Release, SPIRV-Tools ON. Physical devices verified per log: RTX5080
10de:2c02, driver32.0.16.1062; Radeon Graphics/gfx10361002:13c0, driver32.0.21036.18. Required Vulkan, application cache/journal disabled, loaded Khronos1.4.363 verified; verbose serial CTest,30-second limit. Driver caches untouched.This is a composition run on fork
d67cb49872, incorporating main53a0a27bb6, with the upstream fixture byte-identical. Focused targets and libraries built successfully; not literal main, an isolated red/green comparison, a full-suite or title result. AI-assisted: yes (Codex); author responsible.