fix(agc): treat an inverted scissor rectangle as empty #6212
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6212"
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-10-15T03:57:47Z.
What
PSSwanStation (PPSA99248, catalog build22) stops 4 s after start-up on
main:With a temporary print (not part of this PR), the rejected rectangle is viewport scissor 0 (
PA_SC_VPORT_SCISSOR_0_TL=0x88ac061e,_BR=0x08700780): top-left (1566, 2220), bottom-right (1920, 2160). Its top is below its bottom on a 2160-row target.The title renders through its own RADV (its log prints
radv/ps5 submissions), and that's how RADV writes this register.radv_intersect_scissortakes the larger of the two offsets and the smaller of the two ends, andradv_emit_scissor_statewrites the result without a check. So whenever a viewport lies outside the application's scissor, the corners end up crossed. radeonsi uses the same encoding on purpose: its empty scissor on GFX12 is top-left (1, 1), bottom-right (0, 0). So the hardware passes no pixels through a rectangle like this.intersectinGraphics/src/State.cppalready clamps such a rectangle to a zero width or height, and a zero-extent scissor is already used for a collapsed viewport. So this change drops the throw and the draw writes nothing. The reserved-bit check before it stays.agc_driver_graphicsdecodes a generic scissor with its top below its bottom, and one with its left edge right of its right edge, and checks that each leaves an empty scissor.Tested
Ubuntu 24.04, GCC 13.3, Release, on
maina077a88df:agc_driver_graphicspasses 3/3. Withmain'sState.cppand the new checks, it fails with the title's message,inverted scissor rectangle.--to-inteland run on Linux (RTX 4070 Ti, NVIDIA 595.99.02) for 90 s with pad input. Onmainit stops at 4 s. With this change it runs the whole 90 s at about 60 FPS. Screenshots at 15, 40 and 85 s show its library screen ("No games yet", with the copy instructions) and its search keyboard, drawn completely.tools/check_conventions.py --base upstream/mainpasses, andtools/pr_overlap.py --branch fix/agc-inverted-scissorfinds no overlap.@nicolasfalesy ran PSSwanStation (PPSA99248) on Linux with an Intel Arc GPU (Mesa ANV), 40 s per run. On
main5d9dcc42dit stopped in 3 of 5 runs withAGC graphics: inverted scissor rectangle. With this PR, 5 of 5 runs went the full 40 s to its game library screen.@iDiesIrae-Req ran it on Windows (RTX 4070 Laptop, Windows 11, WinLibs GCC 15.2.0, Release), 40 s per run. On
main5d9dcc42dit stopped on the same line in 5 of 5 runs, two of them within 2 s. With this PR (8cc858c48), 5 of 5 ran the whole 40 s to the library screen.@wachi35676 ran it on Windows with an RTX 5070 Ti (NVIDIA 617.42, WinLibs GCC 15.2.0, Release), 45 s per run, swapping only this PR's
.prxinto amain922dc8999library set. Onmainit stopped on the same line in 3 of 3 runs (at 1.7, 6.4 and 12.1 s). With the PR (3d44f17ec), all 3 runs reached the limit, andagc_driver_graphicspassed.Not checked on a console.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:16:46Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppImported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-16T02:40:40Z.
A title that reaches this: PSSwanStation (PPSA99248) from the homebrew catalog, on Linux (Intel Arc, Mesa ANV). The stop is intermittent, so I ran it several times (40 s each):
main5d9dcc42d: stopped in 3 of 5 runs withAGC graphics: inverted scissor rectangle(logged as[videoout] presentation failed: ...or[gpu] driver failure: ...).main5d9dcc42d+ this PR: 5 of 5 runs went the full 40 s with no scissor line and nowhat(), showing its game library screen ("No games yet", no games installed for the test).AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T02:42:15Z.
Thank you, @nicolasfalesy. A catalog title with a before-and-after run on Intel Arc is exactly the evidence this needed. I've added it to the description.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by iDiesIrae-Req on 2026-10-16T04:44:45Z.
Windows run for this PR: PSSwanStation (PPSA99248, catalog build22), RTX 4070 Laptop, Windows 11 26300, WinLibs GCC 15.2.0 r7, Release. Both builds were relinked from the same eboot with the same relinker and differ only in the libraries; 40 s per run, no pad input.
main5d9dcc42dAGC graphics: inverted scissor rectanglein 5 of 5 runs, two of them within 2 smain5d9dcc42d+ 8cc858c48So on Windows the stop reproduces every time, compared with 3 of 5 on Intel Arc. Merged cleanly onto
main, no conflicts.One difference from the Linux numbers: with the PR the title holds a steady 39.95–39.99 FPS here instead of about 60. My display runs at 119.88 Hz, so that's every third vblank. I haven't looked into it, and it is probably separate from this change since
mainnever gets far enough to compare.AI-assisted: yes, Claude Code ran the builds and tests; I reviewed the results.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T04:46:44Z.
Thanks @iDiesIrae-Req, that's the Windows run this PR was missing. I added it to the description. I agree the 40 FPS on your 119.88 Hz display looks separate from this change.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T20:00:30Z.
Rebased onto
maine3838332e(now3d44f17ec).agc_driver_graphicspasses 3 of 3, and^agc_passes 662 of 662.Rechecked PSSwanStation (PPSA99248) on today's
main922dc8999, Linux, RTX 4070 Ti (NVIDIA 595.99.02), 30 s with scripted pad input:main: aborts at 4 s withAGC graphics: inverted scissor rectangle, as before;main+ this PR: runs to the 30 s limit.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-17T21:52:05Z.
PSSwanStation (PPSA99248, build23). Setup: Windows 11, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0, Release. Titles are the authors' GitHub releases, unwrapped with
tools/unwrap_self.pyand converted with--windows. "main" is922dc8999. For "this PR", the PR was cherry-picked onto11acfdd84and only the PR's own.prxwas swapped into the922dc8999library set.AGC graphics: inverted scissor rectanglein 3 of 3 runs, at 1.7, 6.4 and 12.1 s.3d44f17ec): 3 of 3 runs reach the 45 s limit with no error, andagc_driver_graphicspasses.The output is 3840×2160 and doesn't go through the frame dump, so the evidence is the log only. Emulator tested only up to its own UI, with no BIOS or games.
AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T18:55:54Z.
Thanks @wachi35676 for the Windows run on the RTX 5070 Ti, and sorry for not saying so sooner. It's in the description.
AI-assisted: yes (Claude Code)