fix(agc): ignore stale input state for null pixel shaders #1348
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1348"
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 TibixDev on 2026-10-08T00:00:40Z.
What
Use the synthetic null pixel shader's own input and export state. Stale guest interpolation, color-export, or shader-control registers no longer reject it. Ordinary pixel shaders still validate those registers.
Complements #1139, which selects an inactive pixel shader but leaves this input decoder unchanged.
Tested
Fedora 44, Release: graphics tests. The new stale-register regression fails before the fix with
SPI_PS_IN_CONTROL input count exceeds 32, then passes after it. It also checks that an ordinary shader still rejects the same state. Contribution checks pass. Windows was not tested.Checklist
main; no duplicate open PR.Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T02:30:43Z.
Review: COMMENTED
Built and ran it, with a bisect to show the new assertions bite.
Linux (CachyOS, GCC, Release), NVIDIA RTX 3080 Ti:
Mutation check — the parent's
ShaderInputState.cppwith your test kept:The change has two halves and both are load-bearing. The visible one is the behaviour: a null pixel program has no inputs and no exports, so decoding the context's last written values gives it an interpolator count and colour export modes that nobody asked for. The second is the read side effect —
readOralso calledNoteRegisterRead, so the old null path consumed those registers, recording a guest write as used by a shader that ignores it. Now the null path does not callreadfor those five at all, which is the cleaner statement of the same intent: neither the stale value nor the read history crosses into the null program.readOrhas no remaining callers, and theNoteRegisterReaduses elsewhere are the ordinary read paths inDrawDecode.cpp, untouched.The test's control case is what makes it non-vacuous, and it is the detail I would keep. Filling five registers with
0xffffffffis the right probe — read as-is, those decode to a nonsense interpolator count and all-ones target modes, which is exactly what the assertions forbid. But the same context decoded as a non-null program is then required to fail withinput count exceeds 32, which proves the junk is genuinely meaningful input rather than something the decoder would have ignored anyway. Without that control, a fixture whose stale values happened to be inert would pass for the wrong reason and the test would be worth nothing. Adding it is the difference between checking the behaviour and checking that nothing happened.I did not find anything to ask for. The five registers covered are the ones the null path previously read, and the assertions pin each field that could leak from them.
This is a comment, not an approval — I have no merge rights here.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by TibixDev on 2026-10-08T08:24:10Z.
Rebased on
e705d430. Kept #1139’s inert-pixel-stage checks and the upstream SRGB tests. This fix remains distinct: it discards stale input and export state when decoding a null pixel program.Fedora 44 Release:
agc_driver_tests,agc_driver_graphics_tests,agc_driver_pm4_testsbuild; the targeted tests and contribution checks pass. Windows CI is pending.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T11:29:41Z.
Checked build + ctest (442/442,
agc_driver_graphicspasses) and the new test fails without the change. The null-program decode no longer reads stale input/export registers, while ordinary pixel shaders still validate them (test covers both). CI green on the head; merging.