AGC: Sonic the Hedgehog (2006) Recompiled (PPSA99903) draws its stage geometry with stale data unless draws or packet stores are synchronous #11562
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 josealissonbr on 2026-10-26T19:52:35Z.
What happens
In a stage, the floor is invisible (the sky gradient shows through) and the buildings flicker; the frames that go wrong are drawn with a different camera. There is no error.
Title, test or build step
PPSA99903 01.000.000, homebrew: Sonic the Hedgehog (2006) Recompiled (PS5 port of MarathonRecomp), relinked with
--windows --to-intel.AnyPS5 commit
mainae17955d2with local changes, none of them in the label or write-back paths:DB_DEPTH_CLEARdecoded without the finite check, and a new depth surface with a non-finite clear value starts from its plane in guest memory (without this the title stops after the character select);agc_frame_replay;privateRegionscache in libcWindowsMappings::Collect.System
Windows 11 Pro 26200, RTX 5070 (NVIDIA 616.64), WinLibs GCC 15.2.0
x86_64-ucrt-posix-sehr7, Release build.Steps to reproduce
Start the title, pick a character and stand anywhere in the first town stage. The floor stays invisible and the buildings flicker; the flicker gets worse with Shadow Resolution 8192 than with 512.
A 10-frame capture of that spot (
APS5_FRAME_CAPTURE, trigger file) reproduces it offline:Log
No error or warning around the bad frames.
What was checked
Two captures of the same spot, replayed with one switch at a time (3 presented frames each; both captures reproduce the bug without a switch and are correct with
APS5_SYNC_DRAWS):APS5_SYNC_DRAWSAPS5_DRAW_DRAINAPS5_CPU_STORESAPS5_NO_DISPATCH_CACHEAPS5_LOCKED_DRAW_PREPARE,APS5_DRAIN_COMPLETION_LABELSAPS5_PIPELINED_DRAWS=0,APS5_NO_DRAW_RECIPE,APS5_NO_WRITE_EVIDENCE,APS5_NO_GPU_SAMPLE_DUMPSAPS5_NO_RESIDENT_TARGETS,APS5_NO_PENDING_HTILE_FILLS,APS5_LABEL_GATE_ALL,APS5_NO_VALIDATE_SKIPAPS5_SYNC_DISPATCHSET_CONTEXT_REGwhose register offset is a packet header (0xc0004600)APS5_STORE_AT_LABEL=1,APS5_NO_DRAW_KEY,APS5_NO_HOST_IMPORTguest memory is not readableIn the title itself,
APS5_SYNC_DRAWS=1andAPS5_CPU_STORES=1each remove every visual bug, at about 4 fps and 2-3 fps (normally 11-14 fps at 4K). In an earlier session,APS5_STORE_AT_LABEL=1stopped the buildings flickering in the title but not the floor.The shaders store almost nothing (
APS5_TRACE_BUFFER_WRITTEN: 1 written element in the whole replay), so the stale data does not come from a shader writing a buffer. The packet stores the driver records on the GPU (VulkanDevice::WriteLabelOnGpureachingNoteLabel) are 577 small stores in the replay, almost all 4 bytes at two fences:When a switch changes the replay's timing, a submission can contain words that are not packets. In this case a
SET_CONTEXT_REGheader says five values where one belongs, and the next packets' headers follow inside it:The comment in
WriteLabelOnGpudescribes this case: a write-back that the CPU runs at the reap lands after a label that the GPU already made visible, so "a title that rebuilds its command buffer there sees a stale packet". The guard holds a label of 8 bytes or less behind the completions only while a copied writer is listed.APS5_DRAIN_COMPLETION_LABELSdrains only under that same condition, and it does not fix the frames here. My guess is that another write-back that the CPU makes after the batch (storage image results, target or depth plane stores) can land after one of these fences is visible. I have not found which one.