fix(agc): read unwritten user data registers as zero #1037

Merged
Raghav314 merged 1 commit from upstream-pr/1037 into main 2026-10-07 05:00:41 +00:00
Raghav314 commented 2026-10-07 02:54:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-07T02:54:41Z.


What

A stage's user data registers are read for the count in its RSRC2 (COMPUTE_PGM_RSRC2 for compute). A register the title never wrote used to refuse the draw or dispatch with "required shader register has not been written". It now reads 0.

  • Hades II (PPSA36082): the main menu's final draw has a vertex program whose RSRC2 counts 10 user SGPRs, but the title only writes 9; SPI_SHADER_USER_DATA_GS_9 (0x95) is never written, in any bank or packet. The draw was refused and the menu stayed black.
  • Sources for 0:
    • Kyty keeps user SGPRs in a zero-initialized UserSgprInfo.
    • SharpEmu reads a missing user data register as 0.
    • AMD PAL zeroes its register shadow memory and reloads the SH registers from it ("to make sure they're initialized to zeros"); Mesa radeonsi and radv also zero that buffer.
  • Both Kyty and SharpEmu clear the SH registers at a suspend point, as AnyPS5 does, so a register written before one also reads 0 after it.
  • The console's own value is not confirmed, so it is listed in TechnicalDebt.

Tested

Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090.

  • agc_driver_pm4: a written register, one written as 0, unwritten ones read 0, and readRegister still refuses other unwritten registers.
  • ctest: 380/380.
  • Hades II on main + its load PRs: the main menu renders; no draw is refused for an unwritten register.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4767310921 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1037). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-07T02:54:41Z. --- ### What A stage's user data registers are read for the count in its RSRC2 (COMPUTE_PGM_RSRC2 for compute). A register the title never wrote used to refuse the draw or dispatch with "required shader register has not been written". It now reads 0. - Hades II (PPSA36082): the main menu's final draw has a vertex program whose RSRC2 counts 10 user SGPRs, but the title only writes 9; SPI_SHADER_USER_DATA_GS_9 (0x95) is never written, in any bank or packet. The draw was refused and the menu stayed black. - Sources for 0: - Kyty keeps user SGPRs in a zero-initialized UserSgprInfo. - SharpEmu reads a missing user data register as 0. - AMD PAL zeroes its register shadow memory and reloads the SH registers from it ("to make sure they're initialized to zeros"); Mesa radeonsi and radv also zero that buffer. - Both Kyty and SharpEmu clear the SH registers at a suspend point, as AnyPS5 does, so a register written before one also reads 0 after it. - The console's own value is not confirmed, so it is listed in TechnicalDebt. ### Tested Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090. - agc_driver_pm4: a written register, one written as 0, unwritten ones read 0, and readRegister still refuses other unwritten registers. - ctest: 380/380. - Hades II on main + its load PRs: the main menu renders; no draw is refused for an unwritten register. ### 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
github-actions[bot] commented 2026-10-07 03:46:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T03:46:38Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#494 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp L41-44
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6030488451 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1037#issuecomment-6030488451). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T03:46:38Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #494 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp` [L41-44](https://github.com/boykopovar/AnyPS5/blob/b33ac687c9849106b97e9faaf9a4f3ee7758df7b/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp#L41-L44) | | |
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!1037
No description provided.