fix(graphics): allow storage textures in reused depth memory #2904
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2904"
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 Scramblrrrr on 2026-10-10T18:21:22Z.
What
A cached depth surface at a temporary GPU address can block a later storage texture whose extent or format cannot represent that depth plane. Match the newest surface on the same device by extent and plane format/raw depth layout before refusing actual depth/stencil storage access. Incompatible views use the ordinary storage path.
Rebased onto main
bca7a29d2. Keep #419's RequireNoMultisampleTarget guard before the depth admission check. Move the existing limitation under TechnicalDebt's Functional section. Rendered depth is not written back to guest bytes, and descriptor compatibility does not establish allocation lifetime or writer ownership. Matching depth/stencil storage access still throws on this standalone branch; #425/#454 provide broader transfer/retirement and their integration must keep this admission check.Tested
Windows 11 / GCC 15.2 / Release / SPIRV-Tools OFF / RTX 5070 Ti, Vulkan required, head
ef218ef92:Checklist
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T18:30:39Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T04:55:16Z.
I reopened this because it fixes the stop on main directly, so it doesn't have to wait for #425 or #454. Before it can go in:
DepthSurface.cpp: main addedDepthSurfaceHoldsat the same spot, keep both);main" box (the conventions check fails on it) and mark it ready for review;Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:38:35Z.
Additional platform validation of standalone PR head
3514a17a13e30c4820aa3e33b3af3266deadea06(2026-10-11):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.1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.
Checks:
agc_driver_graphics.Command after building:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_graphics$".This scope checks CPU-side behavior; no GPU execution result is claimed.
Internal limitation: heap-mirror subcases returned early because the guest arena was not write-watched in WSL. Zero CTest skips does not include that early return.
No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T08:55:28Z.
Hi! This PR currently conflicts with
main, so I rebased it onto the latestmain(d3e84f85, includes #3296). The conflicts resolved as follows:DepthSurface.cppand its header: main addedDepthSurfaceHoldsand the HTILE metadata helpers at the same spot as this PR'sDepthSurfaceAt(context, words, resource)overload — kept both sides.DepthSurfaceReuse.cpp: kept both sides' test additions; renamed the PR's localstencilconstant tostencil16to avoid shadowing thestenciladdress constant main added in the same function.It builds and
agc_driver_graphics_testspasses locally.If it helps, the rebased branch is available to pull:
Feel free to ignore this if you'd rather rebase yourself.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T10:09:59Z.
Tested on High on Life (PPSA15388 v01.120.000, Unreal Engine 4): this fixes its stop in the intro. With #425 and #454 ported, the run aborted the same way in 2 of 2 runs:
#454's retirement doesn't catch it, because the storage write itself is what reuses the memory. With this PR's two commits on top, the intro plays through and the title reaches its main menu and a save load. That abort hasn't come back in any run since.
Details
Setup: CachyOS (Linux 7.2), RTX 4090 (NVIDIA 615.78), GCC, Release.
mainf5c0fe00plus my local integration patches and ports of #423/#1077, #425 and #454.One conflict with #425, in
ShaderResources.cpp. I kept #425's path that seeds a storage texture from a depth surface, but only when your stricterDepthSurfaceAt(context, words, viewed)matches (extent plus plane format). A storage descriptor that only shares a depth surface's address is now an ordinary storage texture. That is the reused-memory case here: a 120x68 R32 view of 240x135 D16 memory. The depth and storage tests pass (10/10).DepthSurfaceReusesits insideagc_driver_graphics, which stops earlier on my tree on an unrelated span check, so that case hasn't run.Tested and written by Claude (AI assistant) on a contributor's machine.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T12:23:34Z.
Thanks for reopening and for the concrete validation requirements. I applied the conflict resolutions from blawesom's rebase (keeping DepthSurfaceHolds/HTILE helpers and the stencil16 test name) onto current main
1e8fff68cin an isolated worktree, preserving original authorship. Windows build is underway. I added the requested technical-debt disclosure and am validating a real GPU depth producer versus guest bytes in two reuse cases, with a matching sampled plane as the control. I will keep this draft until device checks and conventions pass. Thanks also to Tamalero for the independent High on Life cross-test; I am not treating its integrated result as standalone GPU validation.AI-assisted (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T12:33:17Z.
Updated to 0beaafe6c on main
1e8fff68c; mergeable and marked ready. Windows graphics + depth fast-clear + new device reuse test passed 3/3. The new test has a real depth draw, matching sampled-plane control, and load/store readback for both incompatible storage descriptors. Restoring the old address-only guard makes it fail, restored source passes. TechnicalDebt now explicitly records the missing depth-to-guest writeback and descriptor-only limitation. The description distinguishes matching sampled depth from still-unsupported matching storage on this standalone branch. Thanks blawesom for the conflict resolutions and Tamalero for the cross-test. AI-assisted (Codex).Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T12:34:17Z.
CI limitation on the new head: conventions run 38139635004 fails during actions/checkout, before the checker executes, with fatal: No url found for submodule path 3rdparty/imgui in .gitmodules. The Build run 38139638334 has the same checkout failure in the Linux/Windows relinker jobs. Base main
1e8fff68ccontains that gitlink without a .gitmodules entry; this PR does not change submodules. Local source/body conventions and the selected Windows device checks passed. CI is not green, and I am not claiming full CI validation. AI-assisted (Codex).Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T12:52:42Z.
After #3511 repaired main checkout, rebased again onto
a11c8f7f7: head 4fdbe916e. All six modified source/test/debt files are byte-identical to 0beaafe6c; selected Windows checks passed again, 3/3 in 5.56 s. Local source/body conventions pass and latest conventions CI is green. Remains ready for review. No full build CI claim. AI-assisted (Codex).Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-11T22:15:27Z.
Tested together with #425 on Demon's Souls (PPSA01342 v1.005, US), Windows, RTX 3060 (NVIDIA 591.86):
maina11c8f7f7+ #3871 + #425 at6d59983d3+ this PR at4fdbe916e.The merge with #425 conflicts in
cachedStorageTexture. I kept #425's body (stencil-planeRequire,lookupStorageTexture, thenSeedStorageFromDepth) and seed from depth only when this PR'sDepthSurfaceAt(context, words, viewed)matches, the same resolution queeeef described on #1409.Result: the
storage image access to depth/stencil surface 0x282e10000 is not implementedstop at compute shader0x24893fb00(PlayStation Studios logo) is gone in seven runs. The title reaches its language, brightness and voice settings screens and the opening cinematic. The next stop is unrelated:bindless image table: 18 distinct keys exceed the 16 slots(compute shader0x248947300, #757's area).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:15:07Z.
Conflicts with main in
ShaderResources.cpp: #419 addedRequireNoMultisampleTargetjust above the guard incachedStorageTexture. Please rebase and keep both.While you're there, the TechnicalDebt line sits above
### Build, outside any section; move it under### Functional.Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T00:32:26Z.
Rebased onto
bca7a29d2, new headef218ef92. KeptRequireNoMultisampleTargetfirst and the descriptor-awareDepthSurfaceAt(context, words, viewed)guard after it. The debt entry now appears only under### Functional. Windows RTX5070Ti with required Vulkan: graphics/depth_fast_clear/depth_storage_reuse 3/3 pass, 6.10s; conventions and whitespace pass. No full-suite claim.Thanks fdfawef324 for the seven-run Demon's Souls cross-test and the exact #425 integration resolution. Updated description keeps the integrated-title evidence separate from standalone checks. AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T01:15:54Z.
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)core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL840-844core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL840-844core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL840-844docs/dev/TechnicalDebt.mdL389docs/dev/TechnicalDebt.mdL389-463Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-12T01:21:08Z.
Linux cross-test with 007 First Light (PPSA11386 v01.018.000) on an integrated stack, not this standalone head. Setup: CachyOS, RTX 3080, NVIDIA 615.71.09, GCC 16.2.1, Release, bubblewrap sandbox.
Stack. main
62f875871plus:Merge. I cherry-picked
4de5726d3,b9b83cef2andef218ef92. There was one code conflict, incachedStorageTexture, resolved as in the High on Life and Demon's Souls comments above: seeding from depth happens only whenDepthSurfaceAt(context, words, viewed)matches.RequireNoMultisampleTarget.Runs. First level load, same save and warm caches, one run each:
storage image access to depth surface … is not implemented(breakdown below)registered program refers to an incompatible shader binary type. The tessellation draw wants type 5 (LS), and the code is registered as type 3 (merged LS+HS).The 33 errors without this PR:
The sampled-texture path catches 31 of them and keeps its snapshot. For the other 2, a color target stays non-resident. The 2 same-extent R32_SFLOAT views are the D16 case in
DepthStorageReuse; the rest differ in extent.Tests. On the #2904 build of this stack, the 13 targets matching
agc_driver_(graphics|depth_|image_table|runtime|storage)pass, includingagc_driver_depth_storage_reuse.Not checked. The level doesn't render yet, so there's no visual check of these passes.
AI-assisted: yes (Claude Code)