Recompiler: compute s_swappc_b64 calls through a user-data pointer can't be built (free repro: Unity catalog title, 68 of 250 shaders) #3271
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 kr4y4 on 2026-10-11T04:47:18Z.
What
Compute shaders that call through a user-data pointer pair with
s_swappc_b64still can't be built. Since #1836 they are deferred at registration, but a dispatch of one still throws:So far this has been reported only from retail titles: Ghost of Yōtei and Astro Bot (#1817), Disney Epic Mickey: Rebrushed (johnmaia on #1817, 380 deferred shaders), PPSA15186 (#2207), and Stray, where 371 shaders never prepare and the title stays on its loading screen (#2749).
The same shaders are in a free homebrew title from ps5-homebrew-catalog, so anyone can reproduce this without a retail dump.
Free reproduction
Middle Ages Ping Pong (PPSA28319 01.000.000, Unity, MIT, STL1te/MedievalTennis). The catalog artifact
PPSA28319.ziphas sha2566426468091b42f6512a456004e47a0807ae83fc2af82a4408bef8a51103fbd48; itseboot.binunwrapped from fSELF has sha2562042d0a4d721c42dbdab0a05c44fe56ee1ed33dbe20422b2576351a149a1112.The eboot embeds 300 AGC shader headers (
1234, version0x18). 252 of them are paired with their code by the RELATIVE relocations of the table that points at them, which leaves 250 unique compute shaders.I fed each one through the recompiler offline, without running the title:
COMPUTE_NUM_THREAD_*,COMPUTE_PGM_RSRC1/RSRC2);VulkanDevice::ComputeTargeton an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU;Results on
main961b25fe, for both wave sizes:PrepareResourceProgramandRecompilesucceedRecompileneeds guest memory for an SRT read (expected offline)RecompileneedsshaderBufferInt64Atomics, which the iGPU lacksPrepareResourceProgramthrows thes_swappc_b64error aboveThe 68 failing shaders share one shape, the one johnmaia described for Epic Mickey:
s_swappc_b64 s[14:15], s[14:15], afters_mov_b32 s14, sN/s_mov_b32 s15, sN+1from a user-data pair:s[0:1],s[2:3],s[4:5],s[6:7],s[8:9]ors[12:13].s[14:15].s_branchback over the call).0x3cto0xdc.The start of one of them (the caller passes values in VGPRs and reads
s[0:3]/s[86:87]from its SRT before calling):What the current model rejects
GraphBuilder::analyzeSwappcCallsneeds four things that these shaders don't give it:s[14:15]);s_mov_b32 s14, sNbefore every call);s_setpc_b64return per link pair.Proposed approach
I'd like to implement this, and would like to know first whether this shape is acceptable:
InvocationFor).s_swappc_b64whose source pair was copied from an unmodified user-data pair in the same block, read the callee from guest memory at the user-data address, up to itss_setpc_b64on the link pair.s_getpc_b64, a branch out of its own code, anothers_setpc_b64, or more than a fixed size.s_call_b64 s[14:15]to its copy.s_call_b64saves the same link (pc + 4), and TechnicalDebt already notes that forward callees afters_endpgmare decoded.GraphBuilder.Tests would be:
Two questions:
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-11T05:57:07Z.
#3294 implements the approach above. Two changes from the proposal:
s[14:15], so GraphBuilder pairs each call with the return inside its own copy.sl00metadata in these shaders, aren't kept.@johnmaia, you offered on #1817 to test an implementation on Epic Mickey, and @EdouardSence has Ghost of Yōtei and Astro Bot. A run of #3294 on either would show whether a title actually dispatches these shaders, and what it hits next. I can't run titles here.
Written with AI assistance.