fix(agc): start the viewport control and color masks at the AGC register defaults again #20827
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20827"
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 milescoviello on 2026-11-15T16:16:02Z.
What
This trades one title for sixteen (see "Trade-off" below), so it needs a maintainer's decision.
Update 11-18 (after #23165): #23165 keeps a programmed viewport transform when
0x206was never written. On currentmainthat already turns Super Meat Boy 3D and Steins;Gate upright. MXGP 26 still terminates at 13 s onmainand runs on with this PR (recheck). The other titles below were checked before #23165, so some of them may no longer need this PR.#16053 (merged as
83d984dff5) changed three starting context registers inBuildInitialContextRegisters:PA_CL_VTE_CNTL(0x206) from 0x43f to 0;CB_TARGET_MASK/CB_SHADER_MASK(0x8e/0x8f) from 0 to 0xffffffff.Since then, four titles have been bisected to that merge in its thread. Four of my own rotation titles show the same regression (second table).
maind98cbf5b3e(2 runs)c4efc97014(2 runs)Rect-list SPIR-V: custom per-vertex interpolation is unsupportedmainfbfd87889dbefore #16053)Correction (11-16): the row first listed as Forspoken (PPSA03984) was the Forspoken Mini Artbook (PPSA05999). That is the Unity art-book app that ships in the same disc folder as the game, and my 11-15 runs booted it by mistake (their logs load Unity's
sharedassets). The game itself (PPSA03984-app0) renders upright onmain133feb30f0, through its new-game opening to the courtroom scene, so it isn't one of this regression's titles in the screens reached so far. The art book's before/after stands, under its own ID.Checked on this PR by others since:
maine046f1e4ce, upright with normal colours with this PR. Windows 11, RTX 5060 Laptop, NVIDIA 617.42 (sharveshprabhu).main22317b7339, upright with normal colours and level 1 completed with this PR. Windows 11, RX 6700 XT, AMD 26.10.1 (Feuris).mainc8c044b0d8, upright with this PR, same frame rate (2 runs each). Ubuntu 26.04.1, RTX 2080 Ti, NVIDIA 595.99.02 (klosixgaming-arch).maine238898fc6+ #22052, upright with this PR merged too; the scripted route reaches the lit, textured garage at about 100 s instead of about 690 s, at 8.0 to 8.2 FPS over three runs. Linux 7.3, RTX 3080 Ti, NVIDIA 615.71.09 (mrfelek).maine069a7562f, upright without the wash with this PR. Its state capture showsmaindecoding 77 of 79 draw states withPA_CL_VTE_CNTL = 0, and this PR all 79 with 0x43f. Linux 7.2, RX 6650 XT, RADV Mesa 26.2.7 (JJenkx). A follow-up with this PR reaches village gameplay upright: a loaded save, the opening cutscene skipped and the protagonist moved up the village stairs.--first-parentbisect frombb04a4f1eatoa6b259fd45names83d984dff5(the #16053 merge) as the first bad commit, and its first parent92b57225acas good. Restoring the three values onmaina6b259fd45, as this PR does, gives a correct title screen. Windows 11, Intel UHD Graphics 730 (josealissonbr).mainthe title screen draws only the player character on black; the panorama, logo and menu are missing. A--first-parentbisect names83d984dff5(#16053), with its first parent92b57225acgood. On this title onlyPA_CL_VTE_CNTLmatters:0x206= 0x43f alone brings the whole menu back, and0x8e/0x8fmake no difference. Windows 11, RTX 4080 Laptop, NVIDIA 617.42 (tiny123whoop-png).main28c4880966the COBRA logo and the EULA panel are upside down, the logo's text lines and the panel's text are missing, and the photosensitivity warning is black. With this PR all of them are upright and drawn. A first-parent bisect ends at83d984dff5(#16053). Windows 10, RTX 5080, NVIDIA 621.14 (adam25136).maina85640310d+ #21747. Its draws decode withPA_CL_VTE_CNTL= 0 except inside the title's own context push/pop blocks, which write 0x43f. So it depends on the starting value this PR restores. Windows 11, RTX 5070 (ashwin280802, discussion #23071).Before #16053 both worked on
main: MXGP ran 601 s on3b7f31fa70on 11-12, and SMB3D reached level 1 onb8194198cfon 11-10. Frames are linked under Tested.What the reporters' experiments show:
0x206alone. Setting only{0x206, 0x43f}turns each picture upright (JJenkx, PeterGrieffindor, yinx080). All three call that edit a diagnostic rather than a fix.0x206restored, AEW still stops. With0x206plus0x8e/0x8fat 0, it runs past 240 s, like the parent commit (PeterGrieffindor).0x206restored. yinx080 did not test the masks on their own, so Stray's stop is not shown to follow them. Kao's later stop is the sRGB degamma refusal that #20728 addresses.What this changes
agcPublicRegDefaults*Tbl0Regs:{0x0206, 0x0000043f},{0x008e, 0},{0x008f, 0}).InitDefaultCxStatein libSceAgc builds its default context state from the same public table.agcInternalRegDefaults*Tbl1Regsis the shader-register bank, so its{0x0206, 0}is a different register (correction from JJenkx below), and the internal context-bank lists (Tbl0) have no0x206entry. Neither table is a console measurement.PA_CL_VTE_CNTL = 0still decodes, with a viewport covering its render target, anddrawCovers/DrawRejectionstill accept it.Trade-off (unresolved)
#16053 was itself made for PPSA30528. Its body says that with the old values, the title's first draws decoded a (-1,-1) 2×2 viewport from registers it never wrote, every draw was rejected, and the window was black. With #16053, it renders its loading screen. This PR restores those old values, so it will very likely re-break PPSA30528. I don't have PPSA30528 and have not run it.
The evidence suggests both sides are right for their own titles:
CONTEXT_STATEoperation 3 (push, then clear).PeterGrieffindor tested a split on AEW (comment below): a fresh queue at #16053's values, with
CLEAR_STATE/operation 3 restoring 0x43f and 0. It does not work. AEW stays upside down and tinted, because its picture is drawn in the context it pops back to, which is never cleared. So the fresh-queue0x206alone decides orientation, and the two sides disagree on exactly that one register. Masks of 0 after a clear avoid AEW's stop; the fresh-queue masks made no difference there.PeterGrieffindor also confirmed this branch on AEW: upright, colours right, and running past 240 s on two runs. Until it is known what PPSA30528 does differently before its first draws (asked on this PR), this keeps the previous values, which sixteen titles need.
The four reports above are the reporters' evidence, linked from the #16053 thread. I have run neither those four titles nor PPSA30528. The SMB3D and MXGP results are mine.
Tested
Linux (Ubuntu 26.04.1), GCC 15.2, Release, RTX 4070 Ti (NVIDIA 615.71.09).
agc_driver_graphics_tests,agc_driver_pm4_testsandagc_gcn_color_target_testspass, includingInitialContextTestswith the updated checks.git merge-treeagainstmainis clean.Execution/include/QueueState.hpportests/Graphics.cpp. Against each, this branch produces the same number of conflicts that PR already has againstmain, so it adds none.maind98cbf5b3eagainst this branch, the only difference being these three values.:0, 180 s per run.mainfirst, then this branch first.APS5_NET_DISCONNECTED=1). Results are in the second table above.tools/check_conventions.pypasses on the branch and this body.tools/debt_fold.py --checkpasses with the fragment applied.Correction (11-16, 8:40 PM PT) on Borderlands 4 (PPSA01494): I first wrote that this PR takes BL4 past its 81 s rect-list stop on
main459f4f8c22. It doesn't.459f4f8c22+ this PR), BL4 never reached the screen wheremainstops: it hung during the Borderlands logo and ended at UE's RenderThread watchdog at 174 s, and its log has no rect-list refusal.mainb412486d3e+ both), BL4 reached its first-run Accessibility screen fully drawn in 2 of 3 runs. The other run hung at the logo (196 s) the same way.So for BL4 this PR fixes the UI drawing, as it does for the other titles here, but not the rect-list stop. The queue
0x20WAIT_REG_MEM / RenderThread hang showed in 2 of 4 runs with this PR and 0 of 4 without. That hang has also shown up onmainbefore #16053, so these counts don't pin it on this change. Frames: release bl4-22052-20827-ab.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)main973026d9b0MXGP 26 terminates at 13 s on the Rect-list error; with this PR it runs on to the MyNacon welcome screen, see the 11-18 recheck linked above; for PPSA01494 see the 11-16 correction under Tested)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T18:55:40Z.
Review: COMMENTED
Reviewed — comments
The review covers the changed implementation, tests, and debt entry at head
c4efc97014b11d30b5c61e1790759d543da7781f; no verified blocking defect was found, but the title-specific trade-off remains unresolved.What I ran
Read the prepared description, commit summary, manifest, diff, the full text of the included changed files, and targeted source context through
repo_read.py. No build or tests were run. Author-reported test and title results were not independently verified.Results
Findings
Blocking
None.
Non-blocking
PA_CL_VTE_CNTLto0x43ffor both initial and cleared context. The description says this likely re-breaks PPSA30528, while the proposed fix for its first draws remains unknown. Consider documenting or tracking the title-specific resolution before treating the conflicting defaults as settled. Changed line:core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp:223.0x43fand zero masks as defaults, but does not verify the claimed public SDK default tables in a test. The description and debt entry report that source comparison; it was not independently established by the targeted search. Changed lines:core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:5854andcore/libs/prx/libSceAgcDriver/tests/Graphics.cpp:5855.Not verified
No build, automated test suite, physical-console run, title A/B, or merge check was performed. PPSA30528 behavior was not tested.
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas not read in full; only the changed test and nearby context were read. The review bundle listed three changed files:QueueState.hpp,Graphics.cpp, andfix-agc-restore-initial-viewport-and-masks.md; all changed lines were inspected, and full text was available and read for the first and third files. No excluded-file list was available in the prepared bundle.To get this to a good state
Nothing is required. Optional: resolve or track the PPSA30528 trade-off, and consider adding a test that ties the asserted defaults to the SDK table source.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T21:48:05Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the inspected implementation restores the stated context defaults and retains handling for draws that explicitly set the viewport control to zero.
What I ran
Reviewed head
35d32085ec1b20d48417f0a85939e9094a29e097using the pinnedrepo_read.pyreader. No tests or builds were run. The description reports passing tests and title runs; those results were not independently run here.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded from the review folder because it was too large; its changed lines were inspected in the diff but its full text was not read. The description's test runs, title comparisons, and console default claims were not independently verified. Other files listed as reviewed in the manifest were read:core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hppanddocs/dev/debt/changes/fix-agc-restore-initial-viewport-and-masks.md.To get this to a good state
Nothing is required. Optional: retain the reported before-and-after title evidence and investigate the stated PPSA30528 trade-off.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T00:44:16Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change based on the source inspected; the author-reported title results are not independently verified here.
What I ran
Reviewed head
24d0aa66ef5275df64dd63425ea18ac4445fe899. I readdescription.md,commits.md,manifest.json,diff.patch, the full changedQueueState.hpp, the changed debt fragment, and the changed test ranges inGraphics.cpp.Graphics.cppwas excluded from the review folder because it was too large, so I read its relevant changed ranges throughrepo_read.py.files.jsonwas not available through the reader. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the test suite or independently reproduce any title results. The description notes that PPSA30528 may regress; that title was not available for verification.
files.jsoncould not be read, so I cannot confirm its reviewed/excluded categorization beyond the manifest provided. No files are claimed missing.To get this to a good state
Nothing is required.