feat(agc): depth planes sampled as 2D arrays, cubes and integer views #425
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/425"
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 MichonGoddijn231849 on 2026-10-02T23:57:13Z.
What
Depth surfaces could only be sampled as one 2D slice of their own format. 2D arrays, cubes and the R16_UINT integer view of a D16 plane were refused with
sampling the depth plane of depth surface ... is not implemented.They now work:
DepthPlaneCopy):DepthSliceBytesapart).0x242d4a200samples a D16 plane array that way (reported by @tibzejoker).Storage-image access to depth surfaces was part of this PR at first. #4500 implements it, with stencil planes and the reused-memory fall-through, so it is no longer in this PR.
Part of #1409 (the sampled views; #4500 covers its storage half).
Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), MinGW-w64 GCC 15.2.0, on
main82b1b2e7a.New
agc_driver_depth_plane_samplingloads row 0 through each view and pins the values:It fails on
main(the array is refused) and without the depth-bits format gate (with GTA V's message).agc_driver_graphics,depth_compare_copy,depth_storage_reuse,depth_fast_clear(_submit),depth_bias_per_face,pending_exact_surface,prepared_graphicsandcheck_conventions.pypass.GTA V (PPSA04264): earlier heads of this PR (with the storage half) took the Prologue past its first depth-plane read. I have not rerun the title on this head.
Checklist
main; no other open PR implements the same functions (#4500 is the storage half)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by ThisIsAkill on 2026-10-04T03:35:31Z.
A case from PPSA21567 (Astro Bot) for this PR's depth storage-image path, in case it helps. Linux, on #426 with
mainand other local changes, so not cleanmain. The facts come from a local-only trace; nothing below is a decision.What the title does with one allocation (base
0x53a500000, 960x540, 4 bytes per texel). T# and DB fields are decoded with Mesa'sgfx10-rsrc.json/gfx10.json; swizzle names are from addrlibaddrtypes.h.DB_Z_INFO 0x80000183,DB_DEPTH_VIEW 0)SW_64KB_Z_XTILE_SURFACE_ENABLE0,DB_HTILE_DATA_BASE0, so no HTILESW_64KB_Z_XSW_64KB_R_XCOMPRESSION_EN1,WRITE_COMPRESS_ENABLE1, metadata at about0x5708e4000Every view has the same base, extent, slice 0 and mip 0. The colour view uses the render-target swizzle and DCC; the depth target and the R32F views use the depth swizzle.
Order of uses, every frame once the scene starts:
image_sample_lz/image_load, thenimage_store). In one of them the two T# registers hold the same B10G11R11 descriptor, so it updates the view in place.In earlier frames (before the depth pass appears) the memory is only ever used through the R32F and B10G11R11 views.
On this branch, step 3 throws
storage image access to depth surface 0x53a500000 (960x540, vk format 126) as a 960x540 image of vk format 122, thensampling the depth plane ... as a texture of guest format 36. Both are refused because the views are routed into the depth path by base address.What I could not observe: whether the B10G11R11 read in step 3 depends on the bytes the depth pass left. That depends on the view's DCC keys. The trace sees them as
0000at the first bind anduncompressedat every bind and depth bind after that, with no fills over them. But the driver itself marks keys uncompressed after its write-backs (MarkDccUncompressed), so inside the emulator "uncompressed" doesn't show what the hardware keys would be.A suggestion, for you to judge:
That reproduces the hardware without guessing the title's intent, as long as the colour path itself is exact. The one remaining gap is the DCC keys being rewritten as uncompressed after write-backs. I'm trying this locally and can report how it behaves, if that's useful.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T07:10:21Z.
@boykopovar this one needs your call on where depth bits live when something other than the depth path reads them. This PR copies the slices a host depth surface holds from its depth image and reads every other slice from guest memory. On main, depth surfaces never write back to guest memory (
DepthSurface.cpponly creates and clears the image), so a slice that a host depth surface wrote but no longer holds reads stale bytes without an error.ThisIsAkill described the other model in https://github.com/boykopovar/AnyPS5/pull/425#issuecomment-5976206045: write the depth image back to guest memory when a view with another layout touches it, mark the surface stale, and reseed it at the next depth bind. That changes how depth surfaces work for every title, so it's your decision. My read: the write-back model is the exact one, and this PR's reads are exact only while no host depth surface wrote those slices. It also has no unit test yet.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-04T08:13:40Z.
@ThisIsAkill, thanks, that trace is very useful. You're both right about the gap. This PR copies the slices a host depth surface still holds and reads the rest from guest memory. Because depth surfaces never write back on
main, a slice the surface wrote but no longer holds reads stale bytes.My proposal, for @boykopovar to decide:
If you'd rather go straight to write-back, I'll fold it into this PR instead.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-04T09:16:58Z.
Restacked on the updated #374 (per-aspect HTILE clears) and #294; both still ship inside this PR until they merge. The fast-clear merge keeps this PR's reset of the storage link (
writer,seeded) on a clear, now only when an aspect is actually cleared. Build and ctest are clean apart from the failuresmainhas locally. The layout-matching change I proposed above waits for @boykopovar's call.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T09:52:15Z.
Thanks for the restack. Step 1 sounds right to me as long as one case keeps throwing. In ThisIsAkill's trace the B10G11R11 view comes right after about 50 depth draws into the same memory. Without the write-back, the ordinary colour path would read guest memory the depth image never wrote, so today's refusal would turn into a silent stale read. Could step 1 still refuse a view with another layout while a host depth surface at that address holds depth newer than guest memory, and route only views that alias no live depth surface? The write-back model itself is still @boykopovar's call.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-05T15:40:56Z.
Agreed, that's the right line: a view with another layout should only take the colour path when no live host depth surface at that address holds depth newer than guest memory, and keep throwing otherwise.
One thing to coordinate: #454 (@SP4C3B4R-8) changes the same routing in
DepthSurface::Sampled. A texture whose format doesn't match the depth view returnsnullptrthere and reads guest memory. That's my step 1, but without the check you describe, so it would read stale bytes after ThisIsAkill's ~50 depth draws. I'd rather not have two PRs change that path. I suggest the routing plus your live-surface refusal goes into #454, and this PR stays with arrays, cubes, the R16_UINT view and storage access. If you or @SP4C3B4R-8 would rather I add it here instead, I will.Rebased onto current
main(and today's rebase of #374). The conflict was incachedStorageTexture, wheremainrenamed the resource toviewedfor views past the last mip (#490). The depth seeding now sits on top ofmain's lookup, andmain's own depth-surface refusal there is replaced by it as before. Build and ctest are clean apart from the failuresmainhas locally.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:34:19Z.
That split sounds right to me. #454's author already plans the same rule: retire the depth surface when a colour target, a storage write or a CPU write covers its range, and keep the throw while it's still the latest writer. So moving the other-layout routing there, together with that refusal, keeps one PR on that path. They mentioned being away until 7 October and planned to build on this branch.
So this PR would stay with arrays, cubes, the R16_UINT view and storage access, and none of those reroute other-layout views. The write-back model is a separate question, and it's still with the maintainer.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-06T15:47:59Z.
Thanks, then that's the split. This PR stays with arrays, cubes, the R16_UINT view and storage access. It never reroutes views with another layout: those still throw here, and the routing with the live-surface refusal goes into #454. I'll keep this branch stable for @SP4C3B4R-8 to build on.
Restacked on today's rebase of #374 so the commits it carries match #374's head (now b0414a9f), with no other changes. Builds; the driver tests pass apart from
agc_driver_scalar_sop1, which fails without this PR too.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T17:49:56Z.
Ghost of Yōtei (PPSA26344) writes the stencil plane through this storage path, and on this branch that would stop throwing without being handled, so here's the case.
Its deferred-decal compute shader (0x800027c200) does a per-texel read-modify-write of its 3840x2160 D32S8 target's stencil: it loads the value, ORs in 0x04 and stores it back through an 8_UINT T# at the DB stencil base (0x5004850000, same swizzle as the DB).
DB_STENCIL_INFOhasTILE_STENCIL_DISABLE= 1, so there's no HTILE stencil and the T# is exactly the plane the DB tests. Onmainthe store throws incachedStorageTexture(5 skipped dispatches per run for us).On b0414a9f,
DepthSurfaceAtmatches the stencil address, butSeedStorageFromDepthonly looks fortarget.addressandTransfercopies only the depth aspect. So the store lands in an R8 image over guest memory with no seed and no take-back, while the shader's stencil loads still read the D32S8 image throughDepthSurface::Sampled. Bit 0x04 never reaches the depth surface, and nothing reports it. Vulkan has no storage view of the plane either: neither NVIDIA 610.62 nor lavapipe exposes STORAGE_IMAGE on D32_SFLOAT_S8_UINT or S8_UINT, and RADV refuses stencil formats.Things I noticed while reading, in case they help under whichever model gets picked:
writer/seeded/writerLayerslot per surface, so a dispatch storing to both planes would need state per aspect;SeedStorageFromDepthcallsTakeWritesbut notApplyFastClearbefore seeding, which matters for Z too;htileStencil) would still have to throw; Yōtei doesn't hit that.A test that fails on both
mainand this branch: clear a D32S8 surface to stencil 0x11, look up R8_UINT storage atstencilAddressand expect 0x11, write 0x15, bind it as depth again and expect 0x15 in the stencil aspect. I can send the request file and register dump, or run Yōtei on this branch once the stencil plane is in.Details
DB_Z_INFO0xa0000183 (Z_32_FLOAT, SW 24, HTILE at 0x50050c0000),DB_STENCIL_INFO0x20000181 (STENCIL_8, SW 24). Stencil base 0x5004850000 = Z base 0x5002870000 +DepthSliceBytes(3840x2160, 4).50048500 c0500000 021bc3bf 91800924 0 00700000 0 0.image_loadglc pc 0xa8 and 0x400c,v_or_b32at 0x3ce4 (bit 0x04) and 0x4018,image_storeglc pc 0x401c, at each invocation's own pixel.Transfer), :451 (SeedStorageFromDepth), :494 (DepthSurfaceAt); ShaderResources.cpp:562.stencil_offset), radv_formats.c:118-119.Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-06T21:30:25Z.
@MichonGoddijn231849 agreed on the split, thanks for keeping the branch stable. #454 takes the routing of views with another layout in
DepthSurface::Sampled, with the rule from Dean's review: the depth surface is retired when a colour target, a storage write or a CPU write covers its range (the read then goes to guest memory), and the refusal stays while a live depth surface still holds depth newer than guest memory. I'll rebuild #454 on top of this branch (b0414a9f) rather than onmain, list #425 under Depends on, and add tests for both orders.@Pacuka's case on #454 (a 2848x1600 R32 texture over a 1024x1024 D32 surface) should fall under the same rule; I'll ask for a run once the branch is up.
Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T08:12:51Z.
@Celegans12 thanks, that's a clear case and you're right that this branch would have made it silent. c50f783d:
storage access to a depth surface's stencil plane is not implemented), the same outcome as onmain, so Yōtei's decal pass is skipped as before instead of writing into an unseeded R8 image the depth surface never reads. The depth plane keeps the seed and take-back.SeedStorageFromDepthapplies a pending HTILE fast clear beforeTakeWritesand the copy, as the sampled paths already do.Handling the stencil plane properly needs what you listed: writer state per aspect, a seed and take-back of the stencil aspect through a buffer (no storage view of S8 or D32S8 anywhere), and a refusal while the stencil lives in HTILE. That's a follow-up of its own; your test (clear to 0x11, read through R8 storage, write 0x15, read back as stencil) is the right one for it, and I'd take you up on the request file and register dump then.
@SP4C3B4R-8 this is one commit on top of b0414a9f, no rewrite, so #454 can stay on b0414a9f or move up to it.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T17:31:10Z.
Rebased onto current
mainand the rebased #374 (now d18e8df4), no conflicts. One more commit drops code comments that the conventions check now rejects. #1186 (depth plane arrays from a later base slice) builds on this one. Build and ctest pass.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T05:24:42Z.
This seems to fix #1409: the
storage image access to depth/stencil surface ... is not implementedmessage this PR removes is the one reported there. AddingCloses #1409to the description would link them.Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T13:18:14Z.
Data from a retail title on
main+ this PR, in case it helps scope the storage path.Setup
main07c2405c+ #759 (needed to boot the title) + this PR. Merged cleanly exceptdocs/dev/TechnicalDebt.md.Before / after
compute shader 0x500798d00: AGC graphics: storage image access to depth/stencil surface 0x53a500000 is not implemented(same as #1409 on another title).What the title asks for
B10G11R11_UFLOAT_PACK32(122).R32_*formatsDepthSurface.cppaccepts for a 32-bit depth plane.ctestwas not run for this combination.AI-assisted: the runs and this write-up were done by Claude (Claude Code) on my machine.
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-09T01:43:17Z.
Tested with Stray (PPSA02100 v1.05, Unreal Engine 4). This PR fixes #1409 there, and the same shader then needs storage access to the stencil plane.
Setup: Linux (Nobara 44, kernel 7.2), RTX 5070 Ti, NVIDIA 595.91.07. Base is
main1be6f9f1+ #861 + #1836 + #1837 + #1489 + our open fixes (#1893, #1902, #1904, #1928, #1934), with this PR merged on top.Without this PR, compute shader 0x200bd80000 aborts the run at about 170 s with
storage image access to depth/stencil surface 0x2002320000 is not implemented. With it, the depth plane works and the same shader stops at your guard:The surface is D32S8, 3840x2160. The shader binds its stencil plane as an R8_UINT storage image (guest format 5). A plain
image_loadof the stencil already works through your sampled stencil view; only the storage binding hits the guard.I extended your Transfer/writer model to the stencil plane: https://github.com/fisherjoey/AnyPS5/compare/62b1e552...fix/agc-stencil-plane-storage (+34/-7, on your head):
Transfertakes an aspect. The stencil plane needs an 8-bit storage format and a single layer; anything else still throws.DepthSurfacekeeps a stencil writer next to the depth one, andTakeWritesandApplyFastClearhandle both planes.SeedStorageFromStencilseeds it, andcachedStorageTexturecalls it instead of throwing.Test
agc_driver_stencil_plane_storagereuses yourDepthFastClearHarness. A draw writes stencil 0x5a; a computeimage_loadhas to return 0x5a; a computeimage_storeof 42 then has to make stencil EQUAL 42 pass everywhere and EQUAL 0x5a nowhere. It fails on your head with the guard message and passes with the change. Youragc_driver_depth_fast_cleartests still pass. With it, Stray gets past this shader and stops later on an unrelated layered-target error.Feel free to take it into this PR. #1684 does stencil storage separately and lists conflicts with this PR, so this keeps it to one approach.
Also,
mainadded runtime-metadata validation inShaderResources.cpp(ab0f9985) after this branch's base. Merging this PR onto currentmainkeeps it, but a rebase would make the diff againstmainread cleanly.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:35Z.
@EdouardSence thanks, that narrows it down: a D32 plane bound as a B10G11R11 storage image needs a bit-reinterpreting view or copy, which is out of scope here, so the more specific error is what this PR should give for now. @fisherjoey nice, the stencil writer next to the depth one is exactly how I'd extend it. Could you open it as a PR on top of this one? That keeps this one reviewable and keeps stencil storage to one approach as you said.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:35:11Z.
DepthPlaneCopyreads and detiles every slice no depth surface holds on every use, even when nothing wrote it. In one level of a heavier title that is most of the frame: about 165,000 layer reads per five-minute run.Could you keep a guest slice in the staging buffer with the write generation it was read at (
GuestMemory::CollectWrites), and read it again only when its address, size or tiling changed,GuestMemory::UnchangedSincefails,Recorder::SnapshotWriteOverlapsreports recorded GPU work writing it, or a depth surface held it in between? That is the same rule a cached sampled texture uses for a hit, plus the pending-write check. Without write watching every use still reads. It's about 30 lines inDepthSurface.cpp, applies cleanly on your head62b1e552, and I have it with a test if you want it as a commit.Level fps, level start +30 to +150 s, warm caches, two runs each (#425 alone doesn't get the title to the level, so the base also has the other fixes it needs):
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T14:39:39Z.
Thanks, that is a clear win (and nice numbers). Yes please, could you open it as a follow-up PR on top of this one with your test? That keeps this PR small and credits your change.
Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-09T14:47:35Z.
Another title this helps: Sonic Origins (PPSA05324) on Linux, R9 380 (RADV). Once its clears run (#2022, #1902, #1928, #2219), a compute pass stops at
storage image access to depth/stencil surface ... is not implemented. With this PR merged on top (onlydocs/dev/TechnicalDebt.mdconflicted), it gets past that and presents its boot frames.Bring-up thread: #2021
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-09T15:33:12Z.
Opened as #2325, on top of this PR's head (Depends on #425). It has the same change and the
agc_driver_stencil_plane_storagetest. On Stray the stencil guard no longer fires with it.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-09T17:45:47Z.
Seeker: My Shadow (PPSA12500, Unity) samples a 1024x1024 D32 depth surface as a cube (point-light shadows) and stops with
sampling the depth plane ... dimension 3 ... is not implemented. With this PR it renders past that.Heads-up: it conflicts with #2169/#419 in
DepthSurface.cpp,State.hpp,BufferFill.cpp,PacketMemory.cppand the graphics test, since both carry #374 rebased differently. Resolving was mostly keeping both sides, plus addingwriter.reset()/seeded = nullptrto #419'sApplyFastClear.agc_driver_graphicspasses on the merge.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T19:03:33Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
62b1e552, alone onmainae3d5f95.agc_driver_depth_fast_clear_submitfails intermittently: 3 of 60 runs under ctest and 16 of 120 run directly. It always fails at the same check:The rest of the suite passes (509 of 509). #2076 and the now closed #2325 carry the same test file, and it fails the same way with #2325.
I traced it with local logging on #2325's head. The fill isn't missed: it's noted (
pendingClear= depth), and the next draw'sDepthSurfaceViewapplies the clear with depth 1.0. The problem is which recorder records that clear:VulkanDeviceactivates its recorder only in its constructor, andRecorder::Active()is process-wide. The test opens its own device for the draws. The active recorder changes to another one right when the compute fill is submitted, which matches the driver creating its own device there.ApplyFastClearrecords the clear for the test device's depth image into the driver's recorder. That is anotherVkDevice's command buffer, with no ordering against the test's draw. Before the compute fill the active recorder is still the test device's own, which would explain why the DMA variant passes.So this looks like a problem with two devices in one test process, not with the HTILE handling. Drawing through the same device as the DCB path, or keeping the dispatch off the driver's device, should avoid it.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T22:14:18Z.
Thanks all: Sonic Origins, Seeker: My Shadow and the Windows run are useful data points.
@popcoder565 thanks for tracing it, the diagnosis holds.
agc_driver_depth_fast_clear_submitopens its own device for the draws. When the compute fill is submitted, the driver creates its own device, and from then onRecorder::Active()(process-wide) points at the driver's recorder.ApplyFastClearthen records the test device's clear into another device's command buffer, with no ordering against the draw. The test comes from #374. I'll fix it there tomorrow by making the test draw through the driver's device, like the DCB variant. This PR then picks the fix up when it is rebased.@fisherjoey thanks for #2325; I'll look at it again once #374 and this one land.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T01:28:30Z.
This conflicts with main now. Could you rebase it (onto #374's head, or onto main once #374 is in, since its build is running)? #2490 and #2491 are stacked on it and will follow.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T08:22:30Z.
Rebased onto #374's new head (
28414f92, itself onmainaf1a8edf), heade6451eee. When #374 merges, its two commits drop out of this diff.The rebase needed one fix commit (
e6451eee) to fit main:DepthSurfaceTexturekeeps main's reused-memory rule (9d65003c): a view of another extent, or of an unrelated format, over a depth surface's memory reads as reused memory.DepthSurfaceReusetest caught this.Tested on Windows, RTX 5080:
agc_driver_graphics(withDepthSurfaceReuse),agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submit,agc_driver_depth_bias_per_faceandagc_driver_dword_pattern_fillpass.check_conventions.pypasses.@oneandonlydean your #2490 and #2491 sit on the old head and need the same rebase.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T08:23:55Z.
thank you!!!
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T09:42:36Z.
Could you rebase this on main after #374? It conflicts in
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp. It merges right after #374.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T09:54:32Z.
Rebased onto #374's new head (
94d93e00, onmainbe403084), headd6088bed. No conflicts this time.agc_driver_graphics,agc_driver_depth_fast_clear(_submit),agc_driver_depth_bias_per_face,agc_driver_dword_pattern_fillandcheck_conventions.pypass here. Once #374 is merged, its three commits drop out of this diff.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T11:23:00Z.
Astro Bot on current main with this PR (plus #2647, #1745 and #2653) now reaches the Space Station level, then stops at once on:
A D32 depth surface written as a storage image of another 32-bit format. With the two lines below on your head it runs the level for the full 300 s with no stop, no skipped draws and no errors:
Could you fold this into the PR, or say if you'd rather have it as a follow-up?
Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T16:48:25Z.
Data point from a retail Unreal title, Taxi Chaos 2 (PPSA30279 v01.007.000), which stops on:
With this PR applied locally, the title gets past it. The same local build also has #2054 and a local workaround for #1409. Its next stop is #2102 (
color views of several array slices are unsupported).Windows 11 26200, Radeon 880M (
ANYPS5_GPU=AMD). Dump from my own copy; no game files are shared.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by ponhei9502 on 2026-10-10T20:25:07Z.
A data point from Demon's Souls (PPSA01341) on Linux / RTX 3080, tree
main3cb317fc+ this PR at d6088bed (+ #757 and local Linux fixes): before this PR the title stopped onstorage image access to depth/stencil surface 0x2c25b0000 is not implemented; with it, the same compute dispatch now reportsSo the storage descriptor at that address is a 1280x720 16-bit float colour image (guest format 71, tile mode 7), while the recorded depth surface there is a 1024x1024 D32 target. The sizes do not match at all, which makes me think the title reused the memory of an earlier 1024x1024 depth target (a shadow map) for a colour image, and the depth-surface record for that address is stale by then, rather than the shader reading depth through a storage view. I have not verified when the depth target was last bound; I can add a trace for that if it is useful.
Reproduction:
+ds_enableDebugStartMenu=true, Cross on "Walk Through", Cross on "(0-1) Nexus"; it happens during the level load, about 7 minutes in on a cold shader cache.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:17:27Z.
@AlxcBTW thanks for the Taxi Chaos 2 run.
color views of several array slices(#2102) is a separate gap, not part of this PR.@ponhei9502 agreed, that reads like a stale depth-surface record: the memory of a 1024x1024 D32 target (likely a shadow map) reused for a 1280x720 16-bit float colour image, and the storage view still resolving to the old depth surface. The fix for that is to drop or ignore the depth-surface record once the memory is bound as a colour image of another shape, which is outside this PR's sampling path; I'll take it as a follow-up after this merges. A trace of when the depth target was last bound (draw or clear) before that dispatch would help confirm it, yes.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:38:45Z.
Rebased onto #374's new head (
6d0fe18c, on main379d8b4e) asf98ed5a2, no conflicts. 326/326 agc tests pass on Windows (RTX 5080).Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-10T22:59:28Z.
Replica run of
f98ed5a2(same CI-image setup as on #374: ubuntu:24.04, GCC 13.3, llvmpipe LLVM 20.1.2, SPIRV-Tools on, CI env, userfaultfd write watch active; the tree as pushed, i.e. #3746d0fe18cplus this PR's four commits), since CI'slinuxjob does not run on pull requests.d6088bedon94d93e00(interdiff of added and removed lines empty; 5 files, +321/-41).libsclean. Full suite 729/729 three times at--parallel 4;agc_driver_depth_fast_clear_submit30/30 serial.AI-assisted: yes (Claude Code Fable 5.1 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:52:58Z.
Test of this PR on two titles stopped by #1409, Windows, merged into a local test branch with current
main(06da1176) and my other fix branches. The merge has two additive conflicts (DepthSurface.hpp,DepthSurface.cpp:mainaddsDepthSurfaceHolds/Holds, this PR adds the plane and transfer helpers); I kept both sides, the build is clean and theagc_driver_depth*tests pass. A rebase onto currentmainis needed before it can merge.storage image access to depth/stencil surface ... is not implementedstop is gone. The title now stops atcompute shader 0x1417c4300: buffer descriptor uses an unsupported typein a 100 s run. I have not looked at what that descriptor is.compute shader 0x200ac30000: AGC graphics: storage access to a depth surface's stencil plane is not implemented, which is the stencil limit this PR documents.I did not look at the picture in either run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:59:21Z.
Detail for the Puyo Puyo Tetris 2 stop I reported above (
compute shader 0x1417c4300: buffer descriptor uses an unsupported type). With a temporary local print inmaterializeTables(not proposed), the buffer descriptor at index 0 that fails the type check has the dwordsDword 3 is
0x91b00fac, so bits 31:30 are0b10. I do not know whether this is an image descriptor read where a buffer was expected, an uninitialised table entry, or a genuine other resource type; I only know that the check sees type 2. It is a different problem from the depth-surface one and does not depend on this PR.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:25:27Z.
Review: DISMISSED
#374 is merged, so this needs a rebase onto current
main; its commits now drop out of the diff. Rebasing the four commits of this PR onmain(99c1c263) conflicts in logic, not only adjacency:Graphics/include/Texture.hpp:main(d024709cf) added the depth-copy API (DepthCopyTagconstructor,IsDepthCopy,RefreshDepthCopy,TakeDepthCopyCounts) next to theTexture(..., VkImageViewType viewType)constructor andrefreshedPerUsethis PR adds. The two refresh-per-use mechanisms need to be reconciled (one flag, or one reusing the other).Graphics/src/DepthSurface.cpp:main'sDepthSurface::Holds/DepthSurfaceHolds(2828fdc8c) versus this PR'swriter/seeded/Transfer;DepthSurfaceHoldsshould say what it returns for the per-useDepthPlaneCopytextures.Graphics/src/ShaderResources.cppnoteReusable:mainnow returns early onHasCopiedWrites() || HoldsLease() || usesBda || ...; theRefreshedPerUse()check has to be added to that condition, not to the old one.tests/Graphics.cpp,docs/dev/TechnicalDebt.md: adjacency only.After the rebase please rerun
agc_driver_graphics,agc_driver_depth_fast_clearandagc_driver_depth_fast_clear_submit, and add theCloses #1409line reported by fisherjoey. We'll review again once it is onmain.Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T12:01:06Z.
Stray (PPSA02101 v01.002, UE4) needs this PR and one step more. Without it, the title stops at its first compute pass over a depth surface:
With it, Stray next asks for the stencil plane as a storage image, which this PR keeps refusing:
A commit for that, on this PR's head
847cccc6:ThatsLeo/AnyPS5:feat/agc-depth-stencil-storage(one commit,8c46503d). It follows the depth path:R8_UINT,R8_UNORM,R8_SINT,R8_SNORM), with a staging buffer of its own;DepthSliceBytesapart at 1 byte per texel;DepthStencilPlaneAtand its refusal go away.With both, Stray goes past these passes and renders its first screens (#2749). The commit has no test of its own, and this PR has none for depth storage access yet either. If you want one, I can write it for both planes.
agc_driver_depth_*pass on Intel Arc and lavapipe.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T12:14:57Z.
@adriadam10 thanks, I'll rebase tonight once main is quiet: one refresh-per-use mechanism shared with main's depth-copy API,
DepthSurfaceHoldsdocumented for the per-useDepthPlaneCopytextures, theRefreshedPerUse()check added to the new early return innoteReusable, the three tests rerun, andCloses #1409in the description.@ThatsLeo thanks, that's the right shape for the stencil plane. Please open it as its own PR on top of this one once it's on
main, with the test for both planes you offered. Stray is good evidence for it.@xXPBSXx thanks for both runs. Dword 3
0x91b00fachas type field0x9in bits 31:28, which is an image (T#) where the shader expects a buffer, so it's a different problem from this PR. Could you open an issue for it with that descriptor and the program address?Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-11T14:17:48Z.
A data point from PPSA12544 (Hollow Knight: Silksong), which I listed as needing this PR on #726: on current
main(a11c8f7f, Windows 11, RX 9070 XT) the title no longer needs it. With plainmainand no other changes, it gets through the first scene wheresampling the stencil/depth plane of depth surface ... is not implementedused to stop it, and plays at about 60 fps. That message no longer exists onmain. I haven't traced which change covers this title's case; #3277, for Unity reusing a depth surface's memory, looks the most likely. So this PR is no longer needed for this title, though it may still be for titles that sample depth surfaces.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T14:18:26Z.
@adriadam10 rebased on
maina11c8f7f7(6d59983d3). It is now only this PR's four commits; #374's are gone.Texturehas a singlePerUseCopyfield in place of main'sdepthCopybool and this PR'srefreshedPerUsebool. It isRefreshedOnReusefor main's depth copy of a storage image, which a reused build brings up to date throughRefreshDepthCopyby the image's version, as before. It isRemadePerUsefor this PR's depth plane copy, whichDepthSurfaceTexturemakes again at every use.IsDepthCopy()andRefreshedPerUse()read that field.DepthSurfaceHoldsreturns false for a plane copy. The copy is held by itsDepthPlaneCopy, not by the surface, and a build holding one is never reused.noteReusable: theRefreshedPerUse()check is added after main's new early return (HasCopiedWrites() || HoldsLease() || usesBda || ...).DepthSurfaceTexture.Closes #1409is in the description.On the rebased tree (Windows, RTX 5080):
agc_driver_graphics,agc_driver_depth_fast_clearandagc_driver_depth_fast_clear_submitpass, and 373/374agc_*tests pass. The one failure isagc_driver_emulated_color_compare, where the recompiler refuses an sRGB format this device cannot sample; this PR doesn't touch it. The conventions check passes.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T14:26:49Z.
Review: DISMISSED
Thanks for the rebase. Merged onto current
mainit builds andlibSceAgcDriverctest passes (384/384). What is left before it can merge:R16_UINTcopies inDepthPlaneCopy,SeedStorageFromDepth/TakeWritesround trip, the stencil-plane throw inShaderResources.cpp, the new storage-format refusal inTransfer) are only exercised by titles, which CI cannot run. Please add execution tests next to the existingagc_driver_*ones, with values pinned: write known depth values, sample them as an array slice / cube face /R16_UINT, and write through a storage image then read the depth back. Include a refusal case (other-format storage over a depth surface still throws).docs/dev/TechnicalDebt.mdhas no line for this PR. Please record: the plane copy is re-made at every use (no cache), what remains refused (stencil plane as storage, mips, other layouts), and that the copy/transfer layouts are inferred, not measured on hardware.Closes #1409(you mentioned it in the thread).docs/dev/ARCHITECTURE.md: add a short note on the per-use depth plane copy and the seed / take-back between depth surfaces and storage images, under the section describing depth surfaces.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:45:40Z.
@MichonGoddijn231849 the issue you asked for is #3709 (descriptor, program address, and what the submission looks like). Short version: the four dwords are the start of a complete 1920x1080 2D T# in
COMPUTE_USER_DATA_0..7, and the dispatch runs against the0x1417c4300fill kernel because no shader load precedes it in its submission, so it is not caused by this PR. Ad Infinitum's stencil-plane stop is as you described and is untouched by anything I found.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T17:05:19Z.
Note from merging #419 and this PR (6d59983d3) on top of
maina11c8f7f7for a test: two textual conflicts, both easy and both mine to guess at, so please check them: (1)cachedStorageTextureinShaderResources.cpp: #419 addsRequireNoMultisampleTarget(...)as the first line, this PR replaces the depththrowbelow it; I kept the #419 line and this PR's body. (2) the depth imageusageinDepthSurface.cpp: #419 makesSAMPLEDconditional onsamples == 1, this PR addsTRANSFER_SRC; I usedATTACHMENT | TRANSFER_SRC | TRANSFER_DST | (samples == 1 ? SAMPLED : 0). Both build (relinkerandlibs); I did not run the PR tests or a title on this combination (the title runs are on #419).AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-11T18:32:01Z.
Hi @MichonGoddijn231849, @adriadam10!
Following up on the review feedback regarding execution tests, documentation, and generalized format support:
We tested this implementation on real hardware (Linux CachyOS, RTX 5060 Ti, driver 615.78, Vulkan 1.4) against Astro Bot (PPSA21567) and implemented the requested additions:
FormatR11G11B10Float/B10G11R11) Support:DepthSurface::Transfer, Astro Bot binds 1080p post-processing textures using format 36 (FormatR11G11B10Float, Vulkan 122).sizedchecking viaBlockWidth(descriptor.format) == 1u && elementBytes == (d16 ? 2u : 4u)so multi-channel 4-byte packed formats are accepted without manual enum listing.tests/execution/DepthSurfaceStorage.cpp):agc_driver_depth_surface_storage_tests:agc_driver_graphicspasses.tests/DepthSurfaceReuse.cpp):R16_UINTon D16 depth plane copy.DepthStencilPlaneAt).### Depth surfacesarchitecture section indocs/dev/ARCHITECTURE.md.docs/dev/TechnicalDebt.md.title_controller_ship, animated 3D letters, lighting and cosmic nebula) actively sampling format 122 depth storage transfers.If helpful, the commit is clean, passes
tools/check_conventions.py --base 6d59983d3with zero errors, and is available for cherry-picking:Branch:
feat/pr-425-execution-testson forkhttps://github.com/Kikoarl/AnyPS5.git(commit34dd36000).Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T19:39:22Z.
Ad Infinitum (PPSA10600), Windows,
maina11c8f7f7+ this PR at 6d59983d3 (clean merge, no conflicts), built withrelinkerandlibs. A 60 s run is still compiling shaders and shows no stop; with the shader cache warm, a 90 s run stops with:So the
storage image access to depth/stencil surface 0x20c41f0000 is not implementederror from #1409 is gone with this PR, and the next stop is the stencil plane this PR deliberately still refuses (cachedStorageTexture,Require(!DepthStencilPlaneAt(...))), which Michon said ThatsLeo will do as a follow-up. Nothing else in the log before it. I did not look at the image and did not run Palworld or PPSA25936.State of the PR on my side: it merges cleanly onto
maina11c8f7f7after the rebase; the earlier conflicts with #419 are in my note above.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T19:50:58Z.
Astro's Playroom (PPSA01325) on Linux, RTX 5080,
maina11c8f7f7with this PR at 6d59983d3 (plus PRs 3669, 3750 and 3878, which the title needs to get this far): the layered depth views work and the title gets past itssampling the depth plane of depth surface ... as a 2048x2048 texturestop to the menu and into its first 3D scene. That scene runs at about 1 fps, and a perf sample puts 66% of the process inDepthPlaneCopy::RefreshunderresolveImageBinding.DepthSurfaceTexturecallsRefreshon every lookup of a layered view, so each draw that binds one redoes the whole copy. The scene binds a 16-slice 1024x1024 D32 array of which 3 slices are live depth surfaces, so every refresh reads the other 13 layers from guest memory (52 MiB) and detiles them. I counted 170 to 250 refreshes and 1100 to 1600 guest layer reads per second, 4 to 6 GiB/s of memcpy.A throwaway change that skips a repeat refresh of the same copy within one second took the scene from 0.6-1.1 fps to 4.4-7 fps.
Edit: I wrote a change check as one commit on top of 6d59983d3, in case it is useful:
github.com/fma-rc/AnyPS5@d0ca857225. Each depth surface gets a write generation (set when it is bound as a depth target, fast-cleared or written back from a storage image), guest layers are compared through the write tracker, and only the layers that changed are copied. With it the scene runs at 4 to 9 fps with its shadows drawn andDepthPlaneCopy::Refreshis gone from the profile. It has no test, and the part I am least sure of is skipping the guest-memory check whileCollectEpochandTrackerGenerationhave not moved.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T20:23:58Z.
@MichonGoddijn231849 where Ad Infinitum (PPSA10600) stops after this PR (
maina11c8f7f7+ 6d59983d3):compute shader 0x200ac30000: ... storage access to a depth surface's stencil plane is not implemented, thrown atShaderResources.cpp:836(Require(!DepthStencilPlaneAt(viewed.baseAddress), ...)incachedStorageTexture;DepthSurface.cpp:553defines the predicate asstencilAddress == address && address != target.address). Reading the diff, what a stencil storage path would have to change, as far as I can see (I have not written it):SeedStorageFromDepth(DepthSurface.cpp:486) looks the surface up bysurface->target.address == descriptor.baseAddressonly; for the plane it would needtarget.stencilAddress.DepthSurface::Transfer(DepthSurface.cpp:131) hard-codesVK_IMAGE_ASPECT_DEPTH_BITfor the image-to-buffer copy, a 2- or 4-byte element (d16 ? 2u : 4u) for the staging buffer, and accepts only R16/R32 storage formats; a stencil plane is 1 byte per element and would needVK_IMAGE_ASPECT_STENCIL_BITand an R8 storage format.stencil = target.stencilAddress != 0 && resource.baseAddress == target.stencilAddress,VK_FORMAT_R8_UINT,DepthSurface.cpp:104-118and:449-455), so the plane's format and address handling exist there.All line numbers are from 6d59983d3. This is a reading of the code, not a run of a stencil path.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by ThatsLeo on 2026-10-11T20:47:39Z.
@xXPBSXx @MichonGoddijn231849 the stencil follow-up is ready on top of this PR's current head:
ThatsLeo/AnyPS5:feat/agc-depth-stencil-storage-v2(one commit,d3599578, on6d59983d). I'll open it as its own PR once this one is merged.It makes the three changes your reading lists:
SeedStorageFromDepthalso matchestarget.stencilAddress, andTransfercopies the stencil aspect through a 1-byte-per-texel buffer into R8 storage. It also removes theDepthStencilPlaneAtrefusal incachedStorageTexture. A storage image over the stencil plane then takes the plane's bits as R8, the way the depth plane does as R16/R32. Each plane has its own writer, and the surface takes both back at its next use.The new test,
agc_driver_depth_stencil_storage, works on a D32S8 surface:On this PR's head without the commit, the test fails with
storage access to a depth surface's stencil plane is not implemented. That is the stop in Ad Infinitum. The full suite on Intel Arc (Mesa 26.2.3 ANV) and lavapipe shows the same failures asmain(agc_driver_emulated_color_compareandagc_driver_vop1_float_unaryon Arc;agc_driver_emulated_color_compareandagc_driver_image_plane_address_on_line_implicit_lodon lavapipe).@xXPBSXx if you can run Ad Infinitum with it on top, that would tell whether
0x200ac30000gets further.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T22:14:59Z.
Rebased on current
main(acc5d2949, with #419 merged), headf470ffaa2. The two conflicts are the ones @xXPBSXx described, resolved the same way:cachedStorageTexturekeeps #419'sRequireNoMultisampleTargetfirst, then this PR's seed / take-back body.DEPTH_STENCIL_ATTACHMENT | TRANSFER_SRC | TRANSFER_DST | (samples == 1 ? SAMPLED : 0).The combination also needed one addition: a multisampled depth surface can't go through the image-to-buffer copy of the storage path, so
Transfernow refuses it (storage image access to a multisampled depth surface is not implemented), as sampling already does.agc_driver_graphicsand the depth tests (depth_fast_clear(_submit),depth_bias_per_face,depth_compare_copy,pending_exact_surface) pass, and so doescheck_conventions.py.@Kikoarl thanks for working on the tests. Three things keep me from taking
34dd36000as it is:tests/execution/DepthSurfaceStorage.cppisn't registered inlibSceAgcDriver/CMakeLists.txt, so CI never builds or runs it.R16_UINT, and the depth read back after a storage write. The test checks the two refusals and that a format-36 dispatch doesn't throw, but nothing reads a value back.sizedcheck now accepts any 4-byte single-block format (R11G11B10, RGBA8, ...) over a D32 surface. A post-processing texture at a depth surface's address in Astro Bot is more likely the title reusing that memory than a storage view of the live depth surface, and seeding it from the depth plane would then give it depth bits. That change needs its own case, next to main's reused-memory rule (a view of another extent or format is not the surface).If you'd like to update the branch along those lines, I'll take it in with you as the author. Otherwise I'll write the tests here.
@fma-rc thanks, the per-use refresh is the known cost (TechnicalDebt will say the copy is re-made at every use), and your write-generation approach is the right fix. Please open it as its own PR on top once this one is merged, with a test: an unchanged layer is not copied again, and a changed one is.
@ThatsLeo thanks, that's the stencil path the refusal was waiting for. Opening it once this lands works for me.
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-11T22:15:26Z.
Data point from Demon's Souls (PPSA01342 v1.005, US) on Windows 11 / Server 2025, RTX 3060 (NVIDIA 591.86), MinGW-w64 GCC 15.2.0, Release.
Tree:
maina11c8f7f7+ #3871 + a local fix for a resummarize draw (not yet a PR) + this PR at6d59983d3+ #2904 at4fdbe916e. The two conflict only incachedStorageTexture; I resolved it as queeeef did above (kept this PR's body, and seed from depth only when #2904'sDepthSurfaceAt(context, words, viewed)matches).Without them, the title stops at the PlayStation Studios logo:
With both, that stop is gone in all seven runs: the logo plays, then the language select, brightness calibration and voice/subtitle screens (input through
APS5_PAD_INPUT_FILE), and the opening cinematic starts. Neither the stencil-plane refusal nor the storage-format refusal appeared. The next stop is a bindless table (#757's area):I did not run this PR without #2904, so I can't say which of the two this title needs on its own; ponhei9502's PPSA01341 report above points at #2904's reused-memory case.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-11T23:52:05Z.
GTA V (PPSA04264) data point for this PR, on current
main(325e0a8bd) with this PR at f470ffaa2 merged, Windows 11, RTX 4090.In Story mode, compute shader
0x242d4a200samples a D16 depth surface's planes as a 2D array whose T# reads the raw depth bits as an integer format, and the layered path refuses it:The T# is flagged as depth bits (
DepthBitsTextureWidth == 16), sointegeris false,copyFormatbecomesR16_UNORM, and the requestedR16_UINTno longer matches. Reading D16 depth bits asR16_UINTis the same copy as the integer case, so routing it through the existing integer plane copy is enough:With that, GTA gets past this dispatch and stops later on an unrelated clip-distance export (#423). I have not checked the sampled values against hardware, only that the game goes on. Feel free to take the change or do it differently; I did not want to open a competing PR on top of yours.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-12T00:10:07Z.
Hi @MichonGoddijn231849,
Thanks for the detailed follow-up and analysis!
Reused-memory rule vs format 36 (
R11G11B10):You are completely right. What Astro Bot does at that address is title memory reuse for post-processing rather than an active depth-plane view. Your approach in
f470ffaa2(returningnullptrfor unrelated formats so the normal storage/texture path takes it as reused memory) is much cleaner and avoids accidentally seeding depth bits into post-processing buffers.Tests with pinned values & CI registration:
Agree 100% — placing the tests directly in
tests/DepthSurfaceReuse.cpp(which CI already builds and executes viaagc_driver_depth_surface_reuse_tests) with concrete pinned values for array slices, cubemap faces andR16_UINTround-trips is much more maintainable than a standalone test file.Please feel free to write or adapt the tests directly in #425 as you see fit. Glad the empirical run on Astro Bot helped validate the interaction and conflict resolution. Looking forward to seeing #425 merged!
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T06:49:58Z.
@MichonGoddijn231849 a short check from my side, since this PR is the one that most stops go through: I merged
f470ffaa2onto currentmain(d06c06565) just now and it merges without conflicts (4 commits, your authorship intact); a build of that merge is running here. From your last comment the open items on this PR are the pinned-value execution tests (known depth sampled as an array slice, a cube face andR16_UINT, and the depth read back after a storage write, plus the refusal case), the TechnicalDebt entry and theARCHITECTURE.mdnote. If it helps, I can write the execution test along the lines of the review and push it to a branch on my fork for you to take in as you like (you stay the author of your commits, the test would be a separate commit by me), or hand over run results from titles. If you would rather write the tests yourself, say so and I will not duplicate it. I will report the next stops after your PR on Ad Infinitum and Puyo Puyo Tetris 2 here once my build finishes.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T10:40:57Z.
Windows test of this PR (head
f470ffaa2) merged ontomain9aa5fd290(clean merge, merge commitf26daace4on my fork): MinGW-w64 GCC, Release, RTX 4080 SUPER (NVIDIA driver). Builtagc_driver_graphics_tests,agc_driver_depth_bias_per_face_tests,agc_driver_depth_compare_copy_tests,agc_driver_depth_fast_clear_tests,agc_driver_depth_fast_clear_submit_testsandagc_driver_pending_exact_surface_tests;ctest -R "agc_driver_(depth|graphics$|pending_exact)": 6/6 passed (15.6 s). This is the existing coverage; there is no test yet for the new depth plane copy, seed and take-back paths (the review's open point), so a pass here does not exercise them. Titles on the same tree: Ad Infinitum and Puyo Puyo Tetris 2 get past the depth-storage error (results on #1409).AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T12:37:02Z.
Rebase hint: against current main (
c5675762a) this PR has exactly one conflict, incore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp(cachedStorageTexture). Main now throws "storage image access to depth/stencil surface ... is not implemented" viaDepthSurfaceAt(context, words, viewed)right at that spot; this PR replaces that throw with the stencil-planeRequire,lookupStorageTexture(...)andSeedStorageFromDepth. Resolution: drop main'sif (DepthSurfaceAt(...)) { ... throw ... }block and keep this PR's body. Textual merge only, not built or tested after this particular merge (last Windows result: 6/6 ctest on9aa5fd290+ this PR).AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T13:27:28Z.
@MichonGoddijn231849 @Kikoarl a coordination question so we do not write the same test twice. The open review item is the execution test with pinned values (known depth sampled back as an array slice, a cube face and
R16_UINT; depth read back after a storage write; the refusal case), registered inlibSceAgcDriver/CMakeLists.txtso CI runs it. Is one of you already writing it? If not, I will write it as a separate commit on a branch of my fork (your commits stay as they are, nothing is pushed to your branch) and post the link and the Windows result here, and you can take it in or not. If I hear nothing in about an hour I will start; if you are already on it, say so and I will only run it on Windows and on Ad Infinitum and The Mound.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T13:50:19Z.
Finding while preparing the execution test: with this head (
f470ffaa2) merged onto currentmain(c6efe068a), the existingagc_driver_depth_storage_reusetest fails; it passes on plainmain(same machine, same build tree, rebuilt both ways).That test (from #2904) writes depth into a D32 surface of 64x32, then reads the same memory as a 32x32
R32_FLOATstorage image (Read(*device, 22u, Width / 2u, false, 0.25f), the guest bytes must stay0.25f). The refusal comes from theTransfercheck inDepthSurface.cppthat requires the storage image extent to equal the depth target's extent (descriptor.width != target.extent.width || descriptor.height != target.extent.height, line 138 of the head's file): memory that a title reuses as a differently shaped image is now refused instead of reaching the normal storage path thatmaintakes. Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 4080 SUPER; the other depth tests (depth_fast_clear,depth_fast_clear_submit,depth_bias_per_face,depth_compare_copy,pending_exact_surface,agc_driver_graphics) pass on the same merge. Not checked: Linux, and whether the title cases in #1409 need the stricter check.So the reused-memory rule from #2904 (an image whose shape differs from the depth target is not a view of the depth target) needs to hold in
Transfertoo, not only in the format test, and the pinned-value test I am preparing will include this case.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T14:51:17Z.
Overlap note: PR #4500 (storage image access to depth surfaces, with its own execution test) was opened after this PR and also targets #1409. It takes a view of another extent or format through the ordinary texture path, which is the case where this PR fails \agc_driver_depth_storage_reuse` on `main` (see the comment above). Both touch `DepthSurface.cpp` and `ShaderResources.cpp` (`cachedStorageTexture`), so they will conflict whichever lands second. I am no longer writing a separate execution test for this PR; the Windows build and test results for #4500 will be on that PR.AI-assisted (Claude Code).Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T15:01:27Z.
Title data point for the cube branch of this PR: Harmony's Odyssey (PPSA16827) stops on
mainat a cube-map sampling of a 1024x1024 D32 depth surface as R32_FLOAT (details in https://github.com/boykopovar/AnyPS5/issues/1409#issuecomment-6126865042). The cube branch of the depth-plane copy here may cover it, but that is not tested; a run with this PR merged ontomainis possible once the machine is free.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-12T16:07:46Z.
Rewritten on current
main(82b1b2e7a), heade6d75b417, now only the sampled views. #4500 implements storage-image access to depth surfaces, with stencil planes and the reused-memory fall-through, so I took the storage half out instead of having both PRs conflict:agc_driver_depth_plane_samplingpins the values read: D32 array slices from a drawn surface and from guest memory, all six cube faces, a D16 plane as R16_UINT, a D16 depth-bits array, and the base-slice refusal.@xXPBSXx thanks for finding the
agc_driver_depth_storage_reusefailure: that came from the storage half, which is gone, and the test passes on this head.@tibzejoker thanks for the GTA V case. The test showed that routing a depth-bits R16_UINT view through the integer copy reads 0: for a T# with a depth swizzle the shader converts the sampled depth to its bits itself, so it needs the depth copy, not an R16_UINT image. The fix lets such a view through the format check and keeps the depth copy. The test's depth-bits array case reads both slices' raw values, and without the change it fails with your message.
@Kikoarl a correction to my earlier comment:
tests/execution/*.cppis picked up by a glob inlibSceAgcDriver/CMakeLists.txt, so your test file was registered after all. Sorry about that. The other two points stand. The tests are written now; thanks for offering.@ThatsLeo #4500 also covers the stencil plane as storage, so your branch is worth comparing with it there.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T16:38:07Z.
A diagnosis for the
agc_driver_depth_storage_reusefailure reported above, found in the merge of this head ontomain(2a5eca11c) while looking at Harmony's Odyssey (#1409). Not run yet on the GPU; the build andagc_driver_graphics(mock device, 1/1) pass.maindecides incachedStorageTexturewhether a storage image is a view of a depth surface withDepthSurfaceAt(context, words, viewed)(DepthSurface.cpp, the three-argument overload): it only matches when the extent equals the depth target's and the format is the plane's (or the T# holds depth bits). This head replaces main's throw withRequire(!DepthStencilPlaneAt(viewed.baseAddress), ...)andif (DepthSurfaceAt(viewed.baseAddress)) SeedStorageFromDepth(...), which uses the one-argument overload, so any image at the depth target's address, whatever its shape, goes throughTransfer. Indepth_storage_reusethe 32x32R32_SFLOATimage over the 64x32 target is exactly that case, andTransferthrows on the extent.The change that keeps main's decision is one condition in
cachedStorageTexture:I have this as one commit on top of the merge on my fork (https://github.com/xXPBSXx/AnyPS5/tree/test/depth-harmony-425-on-main,
5ef0e5144); it is for you to take or not, I am not touching your branch. The GPU result ofdepth_storage_reusewith it is still to come.Two questions so that nobody writes the same thing twice, @MichonGoddijn231849 and the maintainers (@oneandonlydean, @adriadam10): #4500 now covers storage image access to depth surfaces (with its own execution test), and Harmony's Odyssey needs the cube branch of the depth-plane copy from this PR (sampling). Would you want the sampling part (2D array, cube,
R16_UINTcopies) to go on as a PR of its own, with the pinned-value execution test the review asks for, and leave the storage part to #4500? I can carry that with your commits' authorship kept, if you prefer it that way; if you would rather do it yourselves, say so and I will only test it.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T16:44:21Z.
GPU result for the one-condition change above (https://github.com/xXPBSXx/AnyPS5/tree/test/depth-harmony-425-on-main,
5ef0e5144, merge of this head ontomain2a5eca11c): Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 4080 SUPER.agc_driver_depth_storage_reusepasses with it (it failed without), and so doagc_driver_depth_compare_copy,depth_fast_clear,depth_fast_clear_submit,depth_bias_per_face,pending_exact_surfaceandagc_driver_graphics(7 of 7 in the filteragc_driver_(depth_storage_reuse|depth_compare_copy|depth_fast_clear|depth_fast_clear_submit|depth_bias_per_face|pending_exact_surface|graphics$)).So the regression is the one-argument
DepthSurfaceAtincachedStorageTexture, and the change above is enough to remove it. Not checked: Linux, other GPUs, and whether any title needs the stricter check.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-12T16:47:14Z.
@xXPBSXx thanks. Your diagnosis is right for
f470ffaa2, but the current heade6d75b417(16:07) is already the split you suggest. The storage half is gone (Transfer,SeedStorageFromDepth,DepthStencilPlaneAtand thecachedStorageTexturechange), so main's three-argumentDepthSurfaceAtdecides again, andagc_driver_depth_storage_reusepasses here with it. What is left is the sampling part: 2D array, cube andR16_UINTcopies, with the pinned-value execution testagc_driver_depth_plane_sampling(array slices, six cube faces, D16 asR16_UINT, the depth-bits array, and the refusal of base slice 1). No need to carry it; a run of Harmony's Odyssey's cube sample on this head would help.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T17:05:08Z.
Title result for the cube branch of this PR: Harmony's Odyssey (PPSA16827) ran 240 s with this PR plus the
cachedStorageTexturechange above without the cube-sampling refusal (details and limits: https://github.com/boykopovar/AnyPS5/issues/1409#issuecomment-6128903521). Rendering correctness and frame rate were not assessed here.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-12T19:45:50Z.
Kena: Bridge of Spirits (PPSA01802) data point for this PR: with it, the title reaches gameplay. Its point-light shadow maps are 128x128 D16 cubes in a 64 KiB Z swizzle, so the detiled rows are padded to 256 texels, and
DepthPlaneCopyrefused them (depth plane copy geometry does not match its layers, about 4,400 skipped shadow draws per run). The fix is in #4722 on top of this head, with aPaddedCubeCasetest. Feel free to take the commit into this PR instead.Imported from boykopovar/AnyPS5. Originally posted by GustavoGamarra95 on 2026-10-12T20:00:34Z.
@MichonGoddijn231849 a case this PR needs for Beast of Reincarnation (PPSA29343, Unreal Engine): at start-up the title samples a 32x32 D16 depth surface as a six-face cube through a depth-bits view (T# format 7, swizzle 24, type cube). Its faces are narrower than a 64 KiB block, so
DescribeSurfacegives padded linear slices of 16384 bytes whileDepthPlaneCopylays out tight 2048-byte slices, and the title stops withdepth plane copy geometry does not match its layers.Two commits on top of this PR's head e6d75b4, in case you want to take them (authorship kept, happy to adjust anything):
agc_driver_depth_plane_sampling(face 0 from the live surface, faces 1-5 from guest memory). The draw helper sizes its color target withColorTargetLayout, since a linear 32x32 target is padded to a 64-pixel pitch.Branch: GustavoGamarra95:fix/agc-depth-copy-padded-slices. On Linux with an RTX 3050 Laptop (NVIDIA 615.78.08) the new case fails on e6d75b4 with the same message as the title and passes with the fix; the six
depthctests pass andtools/check_conventions.pypasses. With it the title boots to its menu on a local branch of current main with this PR, #4500 and the title's other rendering fixes.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T20:47:42Z.
Repeat runs for the branch above (https://github.com/xXPBSXx/AnyPS5/tree/test/depth-harmony-425-on-main,
5ef0e5144), as promised on #1409:agc_driver_depth_storage_reuse,agc_driver_depth_compare_copy,agc_driver_depth_fast_clearandagc_driver_depth_fast_clear_submiteach ran three times in a row, 12 of 12 passes, no flicker (Windows 10, MinGW-w64 GCC 15.2.0, Release, RTX 4080 SUPER, built-j2). With the earlier single run ofdepth_bias_per_face,pending_exact_surfaceandagc_driver_graphicsthat covers the depth tests of the tree. Not checked: Linux, other GPUs, a rendering check of the cube map.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T22:41:13Z.
This needs a rebase on main and two fixes before it can go in:
DepthSurface.cpp:136conflicts with #3846: the view takeshostFormatand keeps yourviewType. The TechnicalDebt entry moves todocs/dev/debt/libSceAgcDriver.md; Conventions fails on it now.Texture.cpp:663: the depth-plane constructor makes no first-layer view, so a 2D array T# over a depth surface bound to a shader image declared 2D gets a null view (ShaderResources.cpp:1622) and reads 0, where main throws. Please create the 2D first-layer view when the view is a 2D array, and pin it in the test:image_loadwith dim 2D on the array T# reads0x00000000for0x3e800000here, with one slice and with three.DepthSurface.cpp:416: since #3846 a D16 surface with stencil is stored as D24 or D32, so the plane copy writes 4 bytes per texel into 2-byte slices (VUID-vkCmdCopyImageToBuffer-pRegions-00183; the R16_UINT view reads0x33for0x3333). Please throw when the surface's host format isn't the plane's, as #4500 does for storage.Merged with main
27873b0fthe rest holds:agc|shaderis 459 of 459, and the new test fails on main's sources with main's refusal.A patch that does the two fixes, if it helps:
Data point from a title we test with: on
mainit stops before its title screen atstorage image access to depth/stencil surface 0x53a500000 is not implemented(compute shader0x50073d500); with #4500 it reachessampling the depth plane of depth surface 0x528c30000 (1536x1536, vk format 126) ... dimension 2 ... is not implemented(compute shader0x500599900); with #4500 and this head merged ontomain682ef0c1it runs 330 s with no stop, error line or device loss. Title and menu then run at 0.78 and 0.63 fps, which is the per-use copy; #2490 and #2491 are for that.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T23:32:49Z.
Pushed the rebase and the two fixes from the comment above so this can go in (head
90d899d98). Your two commits are unchanged apart from the conflict inSampled, which takeshostFormatfrom #3846 and keeps yourviewType; the debt entry moved todocs/dev/debt/libSceAgcDriver.md. The third commit adds the first-slice view for 2D array depth views and the refusal when the device stores the plane in another depth format, with a case for each (DepthPlaneSampling.cpp,DepthSurfaceReuse.cpp).agc|shaderis 461 of 461 here, and a full build is running: https://github.com/boykopovar/AnyPS5/actions/runs/38322596395. I'll merge when it is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T23:36:38Z.
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/DepthSurface.cppL47, L143, L152-154core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppL183core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL47, L143, L152-154core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppL183core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL240-241, L291, L294-295core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL47, L241-242, L290-291, L296-312core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL69-70, L128core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppL478, L537-539core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL1719