fix(agc): initialize stencil control and reference masks #5347
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5347"
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 MathiasDevelopes on 2026-10-13T17:37:54Z.
What
Initialize
DB_STENCIL_CONTROL,DB_STENCILREFMASKandDB_STENCILREFMASK_BF(context0x10b–0x10d) to zero on a new queue and afterCLEAR_STATE. Planet Coaster (PPSA01736 v01.017) enables stencil tests without writing the control register and stopped atmissing register in context bank at DWORD 0x10b (267).The values come from libSceAgc's public register-default tables V0, V4, V5 and V7–V11. Linux's GFX10 clear-state table agrees on the control register but differs on the reference masks; the source and unmeasured console reset behavior are recorded in technical debt. Missing registers elsewhere still throw.
Regressions cover unwritten front/back stencil state, explicit overrides, context reset and the PM4
CLEAR_STATEpacket. Both new regressions failed on unmodifiedmain, including the title's exact0x10berror.Overlap check: #4949 adds sample-location defaults to the same initializer at different lines, with tests elsewhere in
Graphics.cpp. No duplicate stencil-default fix was found.Tested
BUILD_TESTING=ON.main61b8742b6: builtagc_driver_graphics_testsandagc_driver_pm4_tests;ctest --test-dir build -R '^agc_driver_(graphics|pm4)$' --output-on-failurepassed (2/2; 0.11 s and 6.06 s). Subsequently rebased onto8cf6a0bc3; intervening upstream changes affect only the README and demo page. Conventions and whitespace checks passed after the rebase.libstarget was built on the combined bring-up branch. With the separate fiber stack-range fix also applied, Planet Coaster passes the missing-register failure, reaches the main menu and plays audio. The tester reports about 0.2 FPS, a black roller coaster and unresponsive input during the slowdown; an automated run also recorded a WatchDog illegal-instruction trap (0xc000001d,eboot.exe+0x2bf288). Title status: Game bring-up #5342. Full gameplay, Linux and other GPU vendors were not tested.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-13T17:38:00Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:02:53Z.
Rebased onto main; no other change. Could someone with a title that sets stencil state through these registers run it on this head and post the result (title ID, GPU/OS, before/after)? It needs a run before it can go in.