feat(libSceAgcDriver): take a one-layer 2D array view of a depth surface plane as the plane #2076
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2076"
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 jdmagic on 2026-10-09T06:54:11Z.
What
Depends on: #4500; its two commits are included. Only the last commit belongs to this PR.
#4500 takes a storage view of a depth or stencil plane for the depth surface only when the view is a 2D image. A 2D array view of layer 0 with one layer and the plane's extent and format is the same plane, but it took the ordinary storage path and read guest memory instead of the plane.
agc_driver_depth_storage: a one-layer 2D array view of the depth plane reads back depth stored into the surface (0.5 while guest memory holds 0.75), a one-layer 2D array view of the stencil plane reads back the cleared stencil over zeroed guest memory, and a two-layer array view of the stencil plane is not taken for the surface.Sackboy: A Big Adventure (PPSA01289) binds the stencil plane of its 2880x1620
D32_SFLOAT_S8_UINTsurface as a one-layerR8_UINT2D array from a compute shader during presentation.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), NVIDIA GPU, on #4500's head cdfba514 (main
5efd09af+ #4500).agc_driver_depth_storage,agc_driver_depth_storage_reuse,agc_driver_depth_compare_copy,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submit,agc_driver_depth_bias_per_face,agc_driver_graphics: 7/7 passed. The fullctestwas not run on this branch.agc_driver_depth_storagefails witha one-layer 2D array view of the depth plane was not taken for the depth surface.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-09T18:09:25Z.
For reviewers: #2325 (mine) duplicates the stencil-plane part of this PR. I've closed #2325. Its two extra pieces, an HTILE stencil fast clear and a stencil storage test, are in commit
598f7883if you want to cherry-pick them.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:05:35Z.
Additional platform validation on standalone PR head
3313464f115a407aa163cb73edaebdad3128a5e7:Linux: passed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja.
Release /
BUILD_TESTING=ON: built the selected test targets; 1 CTest cases, 0 failures, 0 CTest skips.Tests:
agc_driver_graphics.Reproduce after building the test targets:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_graphics$".Vulkan: Mesa lavapipe 26.2.4 software Vulkan; no native Linux GPU/retail-title validation.
Internal limitation: write-watched guest-heap mirror subcases returned early because WSL userfaultfd async write protection is unavailable. The other graphics assertions ran; zero CTest skips does not include this internal early return.
Integration limitation: a local merge against main
948a526c2has source conflicts; these results validate the standalone PR head, not a resolved merge.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:40:54Z.
Review: DISMISSED
Reviewed the commit that belongs to this PR (3313464f1; the rest is the stack under #425/#2053).
ShaderResources.cpp:568stops throwing,DepthSurface.cppSeedStorageFromStencilis new). A game fix needs a Linux test that fails without it: seed a storage image from a depth surface's stencil plane, dispatch, read it back and check the values, plus a view that must still throw (e.g. R16 or a mipped image). @fisherjoey offered one in598f7883(from the closed #2325) that can be cherry-picked, credited.main(DepthSurface.cpp/.hpp,State.hpp,Texture.hpp,ShaderResources.cpp,tests/Graphics.cpp,DepthFastClearHarness.hpp) and depends on #419, #425, #454, #1186, #1189 and #2053, all still open. Once those are merged, please rebase so only this commit remains.The change itself reads fine: R8 UINT/UNORM/SINT/SNORM at layer 0 with the surface's extent, everything else throws naming the plane. Happy to re-review once the test is in and the bases have landed.
Imported from boykopovar/AnyPS5. Originally posted by queeeef on 2026-10-11T17:21:54Z.
Palworld (PPSA23126, 01.102.999, Unreal Engine) needs this: with #425 (and the other fixes in #2648) presentation stops at
The storage views over stencil planes in one run: 1000x1000, 2048x2048 and 2536x1428, all guest format 5.
I worked around it locally with an ordinary storage image over guest memory (
b8321ec8; wrong data, only for finding later stops). The title then reaches character creation and later faults in title code (#2648, item 10), which may come from that wrong stencil data. I have not yet run this PR's current head with the title.Windows 11 Pro 26300, RTX 2080 Ti, MinGW-w64 GCC 15.2.0 (WinLibs r7), RelWithDebInfo. AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by jdmagic on 2026-10-11T19:03:04Z.
Thanks for the review. Both points are addressed; details are in the updated description.
R16_UINTimage_store: a 16-bitimage_loadat the stencil address isn't refused today, so a load can't serve as the case that must throw.a11c8f7f+ #425's four commits + this PR's three, and merges cleanly; it no longer depends on #419, #454, #1186, #1189 or #2053. I'll rebase again once #425 lands so only this PR's commits remain.Imported from boykopovar/AnyPS5. Originally posted by queeeef on 2026-10-12T15:17:22Z.
A case this PR should handle: a storage image at a stencil plane's address that is not the stencil plane.
In Palworld (PPSA23126), with this PR's
SeedStorageFromStencil(unchanged atf08fc2291) merged locally, a 2536x1428 depth surface (D32_SFLOAT_S8_UINT) has its stencil plane at0x3027630000. Later in the frame the title places a 2536x1428A2B10G10R10color target at that same address: Unreal's transient allocator reuses the memory. That image is 14.5 MB, the stencil plane 3.6 MB.cachedStorageTexturecallsSeedStorageFromStencilfor any storage image whose base is a stencil plane's address, andTransferthen throws. This happened 36 times in one run:The color target stays non-resident (
[gpu] color target ... stays non-resident), and textures over it keep the snapshot path.Seeding only an image shaped like the plane (an R8 format, one slice, one mip, the surface's extent) and treating anything else as reused memory fixes it locally:
The condition is the one
Transferalready checks for the stencil aspect, so a plane-shaped image is seeded exactly as before, and the depth and stencil tests still pass.Limits of this report:
AI-assisted (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-12T22:34:18Z.
@jdmagic for coordination, since the two overlap: #4500 adds storage images over both planes of a depth surface. The stencil plane is bound as an
R8_UINTimage of the surface's extent, seeded with a copy of the stencil aspect before the dispatch and copied back at write-back. I missed this pull request when I opened #4500. The depth-plane storage path of #425 that this one builds on has since been taken out of #425 (its author describes the split on #4500).What this pull request covers beyond #4500:
UNORM,SINTandSNORMviews of the stencil plane, and layer 0 of a 2D array;agc_driver_stencil_plane_storagewith theR16_UINTrefusal.The case @queeeef describes (a 2536x1428
A2B10G10R10image placed at the stencil plane's address) takes the ordinary storage path in #4500, because a view whose format or extent is not the plane's is not treated as the plane.If that works for you, these parts could build on #4500 once it merges. If you would rather structure it differently, I can adjust #4500.
Imported from boykopovar/AnyPS5. Originally posted by jdmagic on 2026-10-12T22:46:49Z.
@ee6aba54 Thanks, building on #4500 works for me. I reworked this PR onto it; the description is updated.
Of the parts you listed, only the one-layer 2D array view is still needed: PPSA01289 binds its stencil plane as a one-layer
R8_UINT2D array, which #4500 sends down the ordinary path. This PR is now that one commit on top of #4500. The rest is dropped:UNORM,SINTorSNORM;R16_UINTrefusal contradicts #4500 sending a view of another format down the ordinary path, which also covers @queeeef'sA2B10G10R10case.@fisherjoey, thanks for
598f7883. Its coverage is now in #4500'sagc_driver_depth_storage, so it is no longer on this branch.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T09:18:42Z.
Review: DISMISSED
#4500 is merged, and it landed with two extra commits from @oneandonlydean (
26dfc464a7,848b97b611) that this PR's last commit doesn't contain. It conflicts with main inDepthSurface.cpp,tests/DepthSurfaceReuse.cppandtests/execution/DepthStorage.cpp(add/add), and it isn't a mechanical rebase:26dfc464a7makes a storage view that is not 2D throwstorage image access to depth/stencil surface ... is not implemented(DepthSurface.cpp:165). This PR's change is to take a one-layer 2D array view as the plane, so it has to be reworked as a narrow exception to that check (layer 0, one layer, plane extent and format), keeping the throw for every other non-2D view.agc_driver_depth_storage_dispatch(dispatch-based test with the refusals). Please put the one-layer array cases (depth, stencil, and the two-layer view that must still throw) there as well as inagc_driver_depth_storage, and check the new tests fail without the change.StoreBackthrough a view replaced by another view of the same plane now throws; say what happens when the dimension change recreates the storage image (the "recreated when the view's dimension changes" part) with respect to that.DepthSurface.cppand thatStoreBackhas to bump the write serial there; keep that in mind when rebasing.Please rebase on current
mainso the PR is only its own commit, rerun the depth/agc tests, and update the body's Tested section for that head (it now says it was tested on #4500's old head and the full ctest wasn't run).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T10:32:37Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceAgcDriver.mdL28-29core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL162-167core/libs/prx/libSceAgcDriver/tests/execution/DepthStorageDispatch.cppL48, L218, L220, L222-224, L304docs/dev/debt/libSceAgcDriver.mdL29Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T11:10:29Z.
Rebased onto main
77b9f7270cso only your commit remains, and added one on top for the review:DepthSurface.cpp: a 2D array view is taken as the plane only at layer 0 with one layer; every other non-2D view still throwsstorage image access to depth/stencil surface ... is not implemented. Your commit keeps the recreate when the view's dimension changes.agc_driver_depth_storagenow checks that, and that two-layer and layer-1 views throw.agc_driver_depth_storage_dispatch: one-layer array views of the depth and stencil planes are dispatched and checked with depth and stencil tests, and a two-layer view still throws. Both tests fail on main and pass here. The debt entry indocs/dev/debt/libSceAgcDriver.mdnow names the one-layer case.Your commit keeps your authorship. Depth tests and the
agc_/guest_ctest set pass on Linux. Merging.