fix(agc): ignore the window offset enable bit of the raster mode #3330

Merged
reyani-dev merged 1 commit from upstream-pr/3330 into main 2026-10-11 08:00:58 +00:00
reyani-dev commented 2026-10-11 07:54:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T07:54:58Z.


What

Carries @xXPBSXx's fix from #3163 (the author is under the intake threshold). The commit is theirs, unchanged (6825e023), and merges cleanly onto current main.

Bit 16 of PA_SU_SC_MODE_CNTL (register 0x205) is enable_window_offset (shadPS4's PolygonControl). DecodeState treated it as an unsupported raster mode, so draws that set it stop with:

AGC graphics: polygon mode, depth bias or nonstandard rasterization is unsupported (register 0x205 = 0x00010240)

DecodeState already rejects any non-zero window offset register (0x80), so with the enable bit set and a zero offset the draw is unchanged. The raster-mode check now ignores bit 16. In agc_driver_graphics:

  • 0x00013a46 must decode like 0x00003a46 (depth bias and back-face culling kept);
  • a non-zero 0x80 must still be rejected.

Titles (from #3163, Windows):

  • Resident Evil 4 (PPSA07411) stops on 0x00010240 on main; its next stops (0x292, #2642) are separate.
  • Record of Lodoss War (PPSA05347) stops on 0x00010244. With the change, the author's run reached the main menu with music.
  • Road of Death (PPSA07286, GameMaker) aborted at its first present on 0x00010244 (@LightStorm72's run on #3163).

Closes #3163.

Tested

Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, NVIDIA RTX 4070 Laptop GPU (driver 616.92), the commit merged onto main 2bb78d2c, with VK_LOADER_DRIVERS_DISABLE=*dzn* (#3255):

  • agc_driver_graphics passes 3/3. With State.cpp reverted to main it fails on the new case (register 0x205 = 0x00013a46).
  • ctest -R "^agc_|video_out|^shader|recompiler": 365/366. The one failure, agc_driver_dcc_keys_first_write, fails on main on Windows since #3158 (#3320, fixed by #3324).
  • check_conventions.py passes, and pr_overlap.py reports no overlap.

I don't have the titles; the title results are from #3163.

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
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4817551571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3330). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T07:54:58Z. --- ### What Carries @xXPBSXx's fix from #3163 (the author is under the intake threshold). The commit is theirs, unchanged (`6825e023`), and merges cleanly onto current `main`. Bit 16 of `PA_SU_SC_MODE_CNTL` (register `0x205`) is `enable_window_offset` (shadPS4's `PolygonControl`). `DecodeState` treated it as an unsupported raster mode, so draws that set it stop with: ``` AGC graphics: polygon mode, depth bias or nonstandard rasterization is unsupported (register 0x205 = 0x00010240) ``` `DecodeState` already rejects any non-zero window offset register (`0x80`), so with the enable bit set and a zero offset the draw is unchanged. The raster-mode check now ignores bit 16. In `agc_driver_graphics`: - `0x00013a46` must decode like `0x00003a46` (depth bias and back-face culling kept); - a non-zero `0x80` must still be rejected. **Titles** (from #3163, Windows): - Resident Evil 4 (PPSA07411) stops on `0x00010240` on `main`; its next stops (`0x292`, #2642) are separate. - Record of Lodoss War (PPSA05347) stops on `0x00010244`. With the change, the author's run reached the main menu with music. - Road of Death (PPSA07286, GameMaker) aborted at its first present on `0x00010244` (@LightStorm72's run on #3163). Closes #3163. ### Tested Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, NVIDIA RTX 4070 Laptop GPU (driver 616.92), the commit merged onto `main` `2bb78d2c`, with `VK_LOADER_DRIVERS_DISABLE=*dzn*` (#3255): - `agc_driver_graphics` passes 3/3. With `State.cpp` reverted to `main` it fails on the new case (`register 0x205 = 0x00013a46`). - `ctest -R "^agc_|video_out|^shader|recompiler"`: 365/366. The one failure, `agc_driver_dcc_keys_first_write`, fails on `main` on Windows since #3158 (#3320, fixed by #3324). - `check_conventions.py` passes, and `pr_overlap.py` reports no overlap. I don't have the titles; the title results are from #3163. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
adriadam10 commented 2026-10-11 08:00:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:00:54Z.


Checked on Linux with the PR merged onto current main: libSceAgcDriver build and ctest pass, agc_driver_graphics passes and fails on the new case with the State.cpp change reverted. The non-zero 0x80 case is still rejected (State.cpp:608), so ignoring bit 16 only affects draws with a zero window offset. Third-party runs on #3163 (Road of Death, RE4/Lodoss) match. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106923698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3330#issuecomment-6106923698). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:00:54Z. --- Checked on Linux with the PR merged onto current `main`: `libSceAgcDriver` build and ctest pass, `agc_driver_graphics` passes and fails on the new case with the `State.cpp` change reverted. The non-zero `0x80` case is still rejected (`State.cpp:608`), so ignoring bit 16 only affects draws with a zero window offset. Third-party runs on #3163 (Road of Death, RE4/Lodoss) match. Merging once CI is green.
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!3330
No description provided.