fix(agc): read a 32-bit depth-bits T# over guest memory through a float view #7346
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7346"
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 thuanquang on 2026-10-18T01:26:25Z.
What
NHL 26 (PPSA26785) aborts before its first frame on plain
main, in all of @frankea's three runs on an RTX 4090, with this message (#5398, discussion #7304):@milchgeldkassierer posted its T# words (
0x11c10f00 0xc1400000 0x010dc1df 0x91800fac 0 0x00700000 0 0): 32_UINT, swizzle 24 (SW_64KB_Z_X), 1920x1080, no metadata. A second one at0x11c0000000is 1176x664. A local switch that read them from guest memory like any other texture got the title past the stop.The recompiler treats a sampled 32_UINT or 32_SINT T# with a depth swizzle as a depth-bits read. It declares a float image and casts the fetched value back to the dword. When no live depth surface matches,
cachedTexturethrew. The 16-bit case already falls back to guest memory through an R16_UNORM view (#188). The 32-bit case now does the same through an R32_SFLOAT view: it detiles the guest bytes as any 32-bit texture, and the shader casts them back unchanged.That only works if the host returns the stored bits of an R32_SFLOAT texel unchanged. On the RX 6700 XT it does, for float denormals, the sign bit alone and quiet and signaling NaN payloads (the test below). A debt entry records that other drivers are not measured.
The same goes for a live depth surface whose extent or base level differs from the T#: the read takes the guest bytes, as the 32-bit float and 16-bit views already do on
main. Whether NHL's0x11c10f0000was ever drawn as depth is the open question @MarcZX100 asked on #5398. If it was, the GTAO input could be stale rather than missing.Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1:agc_driver_depth_plane_samplinghas a new case.SW_64KB_Z_XT#s over guest memory that no depth surface was drawn into. Each slice is filled with one dword:0x00000001,0x007fffff,0x80000000,0x80000001,0x7f800001,0x7fc00001,0xffffffff,0x3e800000and0x12345678.image_loadof a row must return each dword bit for bit.main5229b5b82it fails with the title's message:32-bit integer read of the depth-layout texture 0x200480000, which is no depth surface drawn with, is not implemented.ctest --parallel 4 --timeout 120onmain5229b5b82with this change: 1441 tests. The failures are the onesmainhas here without it:agc_driver_lds_mixed_width_atomics(#5271, #6976),agc_driver_registration_trace(fixed by #7336, merged since), andagc_driver_layered_volume_draw,agc_driver_layered_volume_vertex,agc_driver_subvector_loopandagc_driver_lds_lock_budget. I checked the last four onmain5229b5b82without this change, and they fail there too.agc_driver_depth_plane_samplingpasses 3 of 3, and NHL 26 no longer stops here. A warm-cache run went on to the next stop at frame 423, the pending storage image refusal of #7048.python tools/check_conventions.py --base origin/mainwith this title and body passes.image_sample(the test usesimage_load; both go throughcachedTexture);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)main)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T01:56:51Z.
One convention issue: the new two-line source comment immediately above
GuestDepthBitsCaseincore/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cppconflicts with the repository rule inAGENTS.md(“No comments in code, except#endifand namespace ends”). Please remove it; the test name and assertions already describe the case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T01:58:52Z.
The new diagnostic on #5398 confirms this is the guest-memory case your patch targets: the exact descriptor is
Format32UIntwithSW_64KB_Z_X, and no depth target or storage image ever owned the address in three runs. I linked #7346 from the issue with that conclusion. Once the test comment is removed, the issue author’s offered NHL rerun would provide title-specific validation.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T02:06:45Z.
@thuanquang, thanks for this. We had the same change on a fork branch this evening, not opened, so it's all yours. Its test covers a few of the cases your Tested section lists as not tested, and you're welcome to take it as is: branch
test/agc-depth-bits-guest-memory-7346is your head0563713626plus one commit, 77dba19a52, which addscore/libs/prx/libSceAgcDriver/tests/execution/DepthBitsGuestMemory.cpp(ctestagc_driver_depth_bits_guest_memory).SW_64KB_Z_Xsurface laid out with the driver's swizzle equations, with no depth surface drawn: 32_UINT, 32_SINT and 16_UINT T#s, each read from untracked memory and from a registered guest allocation. On lavapipe the guest allocation's later reads go through a storage image (the GPU detile), so the snapshot path and the storage-image path both run.0x00000001,0x007fffff,0x80000001), quiet and signalling NaNs (0x7fc00000,0x7f800001,0x7fbfffff,0xffffffff) and infinities. On Mesa lavapipe 25.2.8 (llvmpipe, LLVM 20.1.2) every value keeps its bits.32-bit integer read of the depth-layout texture ..., which is no depth surface drawn with, is not implemented; with it, it passes on GitHub's Linux runner (run). On the Windows runner it builds and skips, as there's no Vulkan device there.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T02:10:56Z.
Ran it on the title and on NVIDIA. RTX 4090 (NVIDIA 616.92), Windows 11 26200, Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7, Release; tree
main0bb238b4a+ this PR (fast-forward to056371362),libsand the test rebuilt, NHL 26 PPSA26785 01.060.000 with the same relinkedapp.exeas my #5398 runs, host imports on, no input.agc_driver_depth_plane_sampling: passes 3 of 3, newGuestDepthBitsCaseincluded, so the nine dwords (denormals, the sign bit alone, quiet and signaling NaN payloads,0xffffffff) come back bit for bit through the R32_SFLOAT view on this driver too. That answers the debt entry's open question for NVIDIA Ada / 616.92.NHL 26: the depth-layout stop is gone. On
mainthe title aborted 3 of 3 at frameIndex 223 inVelocityVectorFromDepth(compute shader 0x1150101000, texture 0x11c10f0000; the T# words and the fact that nothing was ever bound as a depth target in those runs are in my #5398 reply). With this PR:run 1 (cold shader cache, 600 s cap): no refusal, no
driver failure; still compiling shaders at the cap (16k misses), so it never reached frame 223. Not a result either way.run 2 (warm): past the stop, and on to the next one about 5 min 38 s in, at frameIndex 423, render pass
TextureCompositeDraw:That refusal is the one #7048 is for (
StorageTexture::markLayersPending, Texture.cpp), so NHL 26's next PR to stack is that one. The 0x870000-byte storage images dropped just before it are the same size as the 1080p R32 texture this PR now reads, for what it's worth.run 3 (warm, with screenshots): past the stop as well, and further: at about 4 min 20 s the window shows the title's legal screen ("NHL, National Hockey League ... DO NOT POWER OFF WHEN YOU SEE THE SAVING ICON") rendered at about 7 FPS, the first real frame this title has drawn on this box. It ended at 4 min 56 s, before the #7048 refusal, on something unrelated to this PR: libSceJson2 threw on a null text pointer from the title,
(
_ZN3sce4Json6Parser5parseERNS0_5ValueEPKcmin libSceJson2/Export.cpp). The title's own log shows three "GPU stopped working" breadcrumb reports it recovered from (frames 172, 173, 272, passesGeneric2DFullScreen/TAAPostSharpen, pipelineFSR2PassAccumulate) before that, so the two warm runs take different paths after the first frames; which of the two stops comes first looks timing-dependent. I'll put the Json one on D7304 with the log; it is not this PR's business.So on NVIDIA Ada the PR does what it says for the title: the depth-layout refusal is gone in all three runs, and the next stops are #7048's storage-image refusal and a libSceJson2 null-text throw. Full stderr of runs 2 and 3 below.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T02:10:58Z.
run 2, warm cache, ends on the #7048 refusal, stderr (32 of 173 lines; per-shader registration notes and the 10 s counters trimmed)
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T02:10:59Z.
run 3, warm cache, ends on the libSceJson2 throw: stderr, 853 of 9866 lines (kept: the first 40, the last 60, and every driver/exception line with one line of context)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T02:20:42Z.
Agreed with @MarcZX10: please remove the two-line comment above
GuestDepthBitsCaseintests/execution/DepthPlaneSampling.cpp(the repository allows no comments in code except#endifand namespace ends). Everything else is ready. Once the new head is up, we rerun CI on it and merge.Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-18T02:56:27Z.
Removed in
4aaa12527; that commit only deletes the two lines.@frankea, thanks for the RTX 4090 and NHL 26 runs. I added them to the Tested section.
@EagleBearerYS, thanks for the extra test. I'd rather keep this PR as it was reviewed so it can go in.
DepthBitsGuestMemory.cpp(32_SINT, 16_UINT and the registered-allocation path) would make a good follow-up PR of your own.