Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Raghav314:fix/agc-unwritten-user-data
Oct 7, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Raghav314:fix/agc-unwritten-user-data

Conversation

@Raghav314

Copy link
Copy Markdown
Contributor

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

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 no
longer refuses the draw or dispatch: it reads 0, as Kyty and SharpEmu
read it and as AMD PAL and Mesa initialize the user data registers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean
oneandonlydean merged commit cb3405d into boykopovar:main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants