fix(recompiler): read SRT words through a null user-data pointer as zero #2989
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2989"
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 CnRJay on 2026-10-10T19:56:23Z.
What
PPSA28416 (STAR WARS: Galactic Racer, UE5) stops on
mainwhile preparing a shader:The shader's SRT walk does an
s_loadthroughs[4:5], a pointer taken from user data. The draw sets that pointer to 0. On the console the load does not run, because the program jumps over it withs_cbranch_execz. The capture evaluates every SRT read when the work is recorded, so it read through address 0 and threw. A null pointer loaded from memory is already handled: the read is poisoned and guarded at run time. A null pointer taken from user data was not.Changes:
Evaluator::EvaluateRawRead: when its handle is not loaded from memory, a read through a null base reads 0 and is counted inResourceSnapshot::nullRootReads. Reads through a non-null unmapped user-data pointer still throw.materializeResultaddsnullRootReadstoRecompileResult::poisonedSrtReads, so a dispatch that reads them is not inserted in the dispatch cache, as for poisoned reads.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 4080.
agc_shader_memory: the two cases that requirednull or misaligned addressfor a null user-data pointer now require the capture to count the reads, give a zero V#, and report at least as many poisoned SRT reads in the recompiled result. With the evaluator change disabled, the test fails withAGC driver: null or misaligned address.main).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:49:10Z.
Checked the evaluator change (
SrtEvaluator.cpp), thenullRootReads→poisonedSrtReadsplumbing, and the TechnicalDebt entry. Scoped to a null base not loaded from memory; non-null unmapped user-data pointers still throw. Built on top of current main:agc_shader_memorypasses; the rewritten cases fail to build without the change. Merging.