fix(agc): draw with DB_RENDER_CONTROL STENCIL_CLEAR_ENABLE #1479
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1479"
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 Aryansh1520 on 2026-10-08T08:53:54Z.
What
A draw with
DB_RENDER_CONTROLSTENCIL_CLEAR_ENABLE(bit 1) was rejected as a whole by the state decoder, so its color output was dropped together with the stencil clear.PPSA28997 (God of War Sons of Sparta) starts every frame with such a draw (
DB_RENDER_CONTROL = 0x22) that also writes the background into its 3840x2160 B10G11R11 scene target. With the draw skipped, the target was never reset, and the title'sDST_COLOR/ONElight sprites multiplied the previous frame's values until they saturated: white areas that grew from moving lit sprites and never faded. Because[gpu] skipped drawis reported once per reason, the per-frame skip showed up only once in the log.The draw is now rasterized like any other, with the stencil state of both faces replaced by: compare
ALWAYS, fail/pass/depth-failREPLACE, compare and write masks0xff, referenceDB_STENCIL_CLEAR. Every covered sample takes the clear value whatever the stencil and depth tests are, and the color outputs are written as usual. The depth/stencil state is decoded for such a draw even whenDB_DEPTH_CONTROLenables no test. Depth clear, copy, resummarize and decompress (0x00001f9d) are still rejected.Related: #1395 recognizes depth/stencil clear draws as image clears and is blocked on proving that a draw covers the surface. This change rasterizes the draw instead, so only covered samples are cleared and the draw's color output is kept; it covers the stencil clear only.
Tested
agc_driver_graphicspasses with two new cases inDepthStencilTests(stencil clear with and without a stencil test inDB_DEPTH_CONTROL); both fail without the change.tools/check_conventions.py --base origin/mainpasses.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 NahuelGenchi on 2026-10-09T05:15:13Z.
Sonic Origins (PPSA05324) clears with draws too. The first has
DB_RENDER_CONTROL0x3, then repeated 0x1, withDB_DEPTH_CLEAR0.0,DB_DEPTH_CONTROL0x777 and no pixel program (#2022 lets those through the precheck). This PR covers the stencil half.I have the depth half (bit 0) ready on a branch: the depth compare forced to ALWAYS with writes on, and the viewport depth range pinned to
DB_DEPTH_CLEAR, with a TechnicalDebt entry since that is inferred, not measured. It changes the sameDB_RENDER_CONTROLmask and the samedecodeDepthcondition as this PR. Would you rather take it in here, or should I open it as a follow-up on top of this one?Bring-up thread: #2021
Imported from boykopovar/AnyPS5. Originally posted by Aryansh1520 on 2026-10-09T05:28:35Z.
Thanks for checking it against Sonic Origins. Please open the depth half as its own PR on top of this one, with
Depends on #1479, since CONTRIBUTING asks for follow-ups in a new PR and it keeps the inferred depth behaviour reviewable separately. I'll keep theDB_RENDER_CONTROLmask and thedecodeDepthcondition here as they are so your branch rebases cleanly; if this needs changes in review I'll mention you.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:56:14Z.
Closing in favour of #1534, which carries this commit with your authorship and adds the two missing guards: a read-only or absent stencil plane throws, and the clear is applied before the ordinary stencil ops are decoded. The depth half can go on top of #1534 instead.
Pull request closed