fix(agc): keep a programmed viewport transform when the viewport control was never written #23165

Merged
oneandonlydean merged 1 commit from upstream-pr/23165 into main 2026-11-18 19:57:41 +00:00
oneandonlydean commented 2026-11-18 19:38:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-18T19:38:56Z.


What

Since #16053 a draw whose PA_CL_VTE_CNTL (0x206) is still at its initial 0 gets a viewport covering its render target. PPSA04263 never writes that register but does program its viewport scale and offset registers, with a negative Y scale. Its transform was dropped, so the whole game image has been upside down on main since 15 Nov (logo, menus and the game itself; an overlay drawn by the host stays upright).

  • The covering viewport is now used only while the first viewport's six transform words (0x10f to 0x114) are still at their initial values, which is the case #16053 describes: a title that programs neither the control nor a viewport.
  • A draw that programmed its transform uses it, as before #16053.
  • The same rule is applied in the coverage check (drawCovers).

An explicit 0x43f and every rejected value behave as they do on main.

Tested

Linux, on main 6286d36449.

Bisect by picture, PPSA04263, 150 s route replays, one build each:

Build Picture
92b57225ac (parent of the #16053 merge) upright
83d984dff5 (merge of #16053) upside down
main 6286d36449 upside down
main 6286d36449 with this change upright (sign-in notice and menu readable)

agc_driver_graphics and agc_driver_pm4 pass. InitialContextTests changes with the rule: its context with a programmed transform and the control never written, which #16053 expected to get the covering viewport, now has to decode to that transform, also with a negative Y scale. A new arm checks that a context whose transform words were never written still gets the viewport covering its render target.

Not tested: PPSA30528, the title #16053 was written for. I have no copy of it. Its case (neither register programmed) keeps the covering viewport, and the second new test arm pins that.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream
  • Unimplemented paths throw; silent stubs are listed under Silent stubs in their library's technical debt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none (regression from #16053)
  • Unblocks: PPSA04263 (picture upright again)
  • GPUs tested: NVIDIA GeForce RTX 4090, Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5382816822 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23165). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-11-18T19:38:56Z. --- ### What Since #16053 a draw whose `PA_CL_VTE_CNTL` (0x206) is still at its initial 0 gets a viewport covering its render target. PPSA04263 never writes that register but does program its viewport scale and offset registers, with a negative Y scale. Its transform was dropped, so the whole game image has been upside down on `main` since 15 Nov (logo, menus and the game itself; an overlay drawn by the host stays upright). - The covering viewport is now used only while the first viewport's six transform words (0x10f to 0x114) are still at their initial values, which is the case #16053 describes: a title that programs neither the control nor a viewport. - A draw that programmed its transform uses it, as before #16053. - The same rule is applied in the coverage check (`drawCovers`). An explicit `0x43f` and every rejected value behave as they do on `main`. ### Tested Linux, on `main` `6286d36449`. Bisect by picture, PPSA04263, 150 s route replays, one build each: | Build | Picture | | --- | --- | | `92b57225ac` (parent of the #16053 merge) | upright | | `83d984dff5` (merge of #16053) | upside down | | `main` `6286d36449` | upside down | | `main` `6286d36449` with this change | upright (sign-in notice and menu readable) | `agc_driver_graphics` and `agc_driver_pm4` pass. `InitialContextTests` changes with the rule: its context with a programmed transform and the control never written, which #16053 expected to get the covering viewport, now has to decode to that transform, also with a negative Y scale. A new arm checks that a context whose transform words were never written still gets the viewport covering its render target. Not tested: PPSA30528, the title #16053 was written for. I have no copy of it. Its case (neither register programmed) keeps the covering viewport, and the second new test arm pins that. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt and the licence notice of code adapted from upstream - [x] Unimplemented paths throw; silent stubs are listed under Silent stubs in their library's technical debt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none (regression from #16053) - [x] Unblocks: PPSA04263 (picture upright again) - [x] GPUs tested: NVIDIA GeForce RTX 4090, Linux - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!23165
No description provided.