AGC frame capture: depth planes kept only on the GPU are not captured, so agc_frame_replay draws Minecraft Dungeons II (PPSA16064) terrain black #15113
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 splice11 on 2026-11-02T17:05:07Z.
What happens
A capture of Minecraft Dungeons II replays with its terrain and the campfire light solid black. The title samples a 2048x2048 D16 depth plane (a cached shadow map) that it drew before the capture window. AnyPS5 keeps that format only on the GPU (only D32 with 64 KiB Z swizzle is mirrored to guest memory), so the capture never holds its contents, and the replay samples empty depth.
Reading such planes back at capture start and restoring them in the replay fixes it. Squid Coast and the camp title screen then replay within 0.05 to 0.7 of 255 mean difference of the title's own frames. The changes are on a lab branch, not yet split into PRs: https://github.com/splice11/AnyPS5/tree/lab/frame-capture-mcd2 (
b928638b98).Three smaller things came up on the way. Two may already be covered by open PRs.
Title, test or build step
Minecraft Dungeons II, PPSA16064 01.100.100, the camp title screen ("Press any button") and Squid Coast.
AnyPS5 commit
maine450145140with #11346, #11575, #11611 and #11630 merged locally, a local commit for layered mesh draws and MCD2 debug hacks (9ecc0b6269), and the lab branch above on top.System
Nobara Linux 44 (kernel 7.3.0), GCC 16.2.1, AMD Radeon RX 6700 (RADV, Mesa 26.2.6).
Steps to reproduce
On
mainthe capture itself stops after 2 calls (item 2 below); the lab branch'sAPS5_FRAME_CAPTURE_DELTA_WAIT_MS=200gets it through.Log
With a lab diagnostic that logs each depth-like texture the title samples, and whether a live depth surface backs it:
0x3079910000(2048x2048 D16) is sampled from a live surface;With the fix, capture start reads back every single-sample depth plane that is not mirrorable:
Camp: 3 planes, 74 MiB. Squid Coast: 7 planes, 522 MiB.
What was checked
Game frame on the left, replay on the right.
Before (mean difference 30.0 of 255):

After (0.05):

Mean absolute difference per channel (0-255), first display buffer, three replays of one capture each:
Camp run 3 has a few garbage texels (green and orange blocks) on some foliage; not explained yet.
How the lab branch does it.
Graphics::ReadBackDepthSurfaces()copies each plane to a host-visible buffer at capture start, and the recorder writes them tocapture/depth.bin(saved_depth_planesincapture.json). In the replay, a plane is restored when the frames first create its surface (drawn first) or first sample it (sampled first). Limitation: a plane with several slices (a 1024x1024 cube shadow, slices 0..5) is saved as slice 0 only.Other findings on the same captures:
prologue_host_ranges: 9 on camp, 10 on Squid Coast). It copies them withprocess_vm_readvbefore the snapshot, because the title frees heap pages meanwhile and a plain copy crashed.Submitwith one submission in flight, the delta's idle wait times out (3000 ms made no difference), and the capture stops after 2 calls. The lab branch records it anyway after a timeout and counts it (unsynced_deltas, one per frame). Dropping these deltas breaks the replay, so they hold needed data. This looks like what #12567 fixes; I haven't tried it.--no-synthesize --release-after-ms 200, it is stable. #12568 (GPU-stored words out of deltas) may be the real fix.Also,
agc_frame_replaynow registers restored direct-memory ranges with the guest write watch, as the title does when it maps them. That didn't change the image, but it matches the game.Happy to split the depth-plane part into a PR on
mainwith a test, if this approach looks right.AI-assisted: yes (Claude Code)