fix(agc): treat a view past a depth surface's first level as memory #5982
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5982"
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 milescoviello on 2026-10-14T18:15:17Z.
What
Forspoken (PPSA03984) builds a depth pyramid from its 1984x1116
D32_SFLOAT_S8_UINTdepth surface: a compute shader samples one level of a five-level R32F view at the surface's address and stores the next. It stops at the first sample:A depth surface is one level here, because the driver rejects draws that render a depth mip (
DB_DEPTH_VIEW MIP_LEVEL). A view at the surface's address and extent that starts at a later level does not read or write that level, so it is not the depth plane: what it reaches was written by other GPU work or the CPU.DepthSurfaceTextureandDepthSurfaceStoragesent such views to the surface anyway, and the surface rejected the level. They now return no surface for a sampled or storage view that starts past the first level, or a storage access to a later level. The texture and storage caches then read it from memory, as they already do for a view of another extent or format. The level check inRequireStorablecan no longer fail and is removed.A view that starts at the first level and also covers later levels is unchanged: it still includes the depth plane, and sampling it is still rejected.
agc_driver_graphicsgains a five-level R32F view of a D32 surface's own extent: its first level must still sample the depth plane, and a view of level 1 must be read as memory. Inagc_driver_depth_storage, a storage access to level 1 and a storage and a sampled view of level 1 must leave the depth surface alone. The storage check there expected "not implemented" before. Withmain'sDepthSurface.cppthe graphics test stops with the "levels 1-1" error above and the storage test with "storage image access to level 1 of the depth plane".Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
mained835aa76, RTX 4070 Ti with NVIDIA 595.99.02:libSceAgcDriverpass.agc_driver_stencil_ref_exportis skipped because the device lacksVK_EXT_shader_stencil_export, andagc_host_import_sparseandagc_driver_sparse_dma_buf_importbecause/dev/udmabufis not accessible here.--to-inteland run on Linux under a 15 GiB memory cap, measured onmain4d5411d7b. All builds carry #5937, #5511 and #5975, which the title needs to get this far, start from the same filled shader cache and differ only inlibSceAgcDriver.prx:vkAllocateMemoryruns out of device memory for a storage texture.storage image access to level 1 of the depth plane of depth surface 0xa22af20000 is not implemented.tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branchfinds no overlap.PPSA03984-app0) on currentmain8856f180c, 1920x1080, pad input, one run each:mainstops at 22 s on theDB_RENDER_CONTROLcheck (#5937); with #5937 it stops at 61 s on the indirect vertex buffer read (#5975); with #5937 and #5975 at 116 s on the depth pyramid view (#5982); with all three it draws an in-game scene by 60 s (the lower half still black, about 4 FPS) and runs to 195 s, wherevkAllocateMemoryfor a render target fails withVK_ERROR_OUT_OF_DEVICE_MEMORYon the 12 GB RTX 4070 Ti. The memory goes to retired depth surfaces that are never freed. With #6465 added as well, it reaches a 600 s limit (onmain0c4816f61).Not checked on Windows or on a console.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:12:44Z.
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/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthStorage.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:06:39Z.
Checked on main + this PR:
libSceAgcDriverctest passes exceptagc_driver_tessellation, which segfaults on RADV on main as well. WithDepthSurface.cppreverted,agc_driver_graphicsandagc_driver_depth_storagefail, so the new checks do exercise the change. A view starting past level 0 now goes to memory, and level 0 of a mipmapped view still samples the depth plane. Merging once the full Build is green.