test(libSceAgc): find MRT0 through the compact versioned register defaults #7692

Merged
PhialsBasement merged 1 commit from upstream-pr/7692 into main 2026-10-23 11:14:17 +00:00
PhialsBasement commented 2026-10-19 00:22:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PhialsBasement on 2026-10-19T00:22:09Z.


What

Follow-up to #7681, which made the versioned register-defaults tables hand out compact 12-byte type entries again (RegisterDefaultsTypeLayout::Compact) and kept the legacy sceAgcGetRegisterDefaults on 8-byte pairs. That PR dropped the MRT0 checks on the versioned tables when they stopped being pairs. This restores them for the compact layout and records which entry point hands out which layout. No production code changes.

  • Test (agc_commands, agc_initialization): colourTargetBlock takes the entry size. MRT0 (key 0x38e92c91) is block 78 through the legacy pairs and through the compact sceAgcGetRegisterDefaults2(13) table, block 73 of the compact version 10 table, and every versioned table from 4 to 13 holds it with the sixteen colour-target registers. #7681's first-entry checks (checkCompactTypes) stay as they are.
  • Debt entry (docs/dev/debt/libSceAgc.md): sceAgcGetRegisterDefaults2, sceAgcGetRegisterDefaults2Internal, sceAgcGetRegisterDefaultsInternal and sceAgcInit hand out the compact entries. SDK-built code walks the tables of the first two with a 12-byte stride, reads the key at +0 and the bank and index from the low 10 bits of the word at +4, and keeps an all-ones sentinel for a key it does not find. The legacy internal call's console layout is not known.

Tested

Linux (CachyOS), AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4), based on main b5be95ff0:

  • agc_commands, agc_initialization and guest_shader_link pass.
  • With sceAgcGetRegisterDefaults2 handing out pairs for every version but 13, agc_commands fails on the restored check ("MRT0 defaults key is missing, repeated or outside the context blocks"); with pairs for every version it fails first on #7681's "legacy register defaults reused the compact versioned table".
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py reports only this PR's earlier, conflicting revision.

Windows and macOS: not built.

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 under Silent stubs in their library's technical debt file
  • 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 (#7681 is merged)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (libSceAgc tests only)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4914099102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7692). Originally posted by [PhialsBasement](https://github.com/PhialsBasement) on 2026-10-19T00:22:09Z. --- ### What Follow-up to #7681, which made the versioned register-defaults tables hand out compact 12-byte type entries again (`RegisterDefaultsTypeLayout::Compact`) and kept the legacy `sceAgcGetRegisterDefaults` on 8-byte pairs. That PR dropped the MRT0 checks on the versioned tables when they stopped being pairs. This restores them for the compact layout and records which entry point hands out which layout. No production code changes. - Test (`agc_commands`, `agc_initialization`): `colourTargetBlock` takes the entry size. MRT0 (key `0x38e92c91`) is block 78 through the legacy pairs and through the compact `sceAgcGetRegisterDefaults2(13)` table, block 73 of the compact version 10 table, and every versioned table from 4 to 13 holds it with the sixteen colour-target registers. #7681's first-entry checks (`checkCompactTypes`) stay as they are. - Debt entry (`docs/dev/debt/libSceAgc.md`): `sceAgcGetRegisterDefaults2`, `sceAgcGetRegisterDefaults2Internal`, `sceAgcGetRegisterDefaultsInternal` and `sceAgcInit` hand out the compact entries. SDK-built code walks the tables of the first two with a 12-byte stride, reads the key at +0 and the bank and index from the low 10 bits of the word at +4, and keeps an all-ones sentinel for a key it does not find. The legacy internal call's console layout is not known. ### Tested Linux (CachyOS), AMD Radeon RX 9070 XT (RADV, Mesa 26.2.4), based on `main` `b5be95ff0`: - `agc_commands`, `agc_initialization` and `guest_shader_link` pass. - With `sceAgcGetRegisterDefaults2` handing out pairs for every version but 13, `agc_commands` fails on the restored check ("MRT0 defaults key is missing, repeated or outside the context blocks"); with pairs for every version it fails first on #7681's "legacy register defaults reused the compact versioned table". - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` reports only this PR's earlier, conflicting revision. Windows and macOS: not built. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 (#7681 is merged) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (libSceAgc tests only) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-19 01:27:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T01:27:40Z.


Thanks. The layout split here (pairs for the legacy sceAgcGetRegisterDefaults; compact 12-byte entries for sceAgcGetRegisterDefaults2, ...2Internal, ...Internal and sceAgcInit) is the same one #7681 merged as fea306dff7 shortly before this PR was opened (RegisterDefaultsTypeLayout, default Compact). So main already hands the compact entries to these callers, and the production part of this PR now conflicts with identical behaviour.

Two parts are still worth having as a small follow-up on top of #7681:

  1. The tests: colourTargetBlock with an entry-size parameter, checking MRT0 at block 78 and 73 through the compact v13 and v10 tables and walking versions 4-13. #7681 dropped those checks when the versioned tables stopped being pairs, so this would restore them for the new layout.
  2. The debt line describing which entry point hands out which layout. Please leave the title ID out: the project's rule is that docs/dev/debt lines don't name titles. A description such as "SDK-built code walks the tables of the first two with a 12-byte stride…" says what's needed without it.

Could you rebase onto main, drop the production hunks, and keep the tests and the debt text on #7681's RegisterDefaultsTypeLayout?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6257706206 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7692#issuecomment-6257706206). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-19T01:27:40Z. --- Thanks. The layout split here (pairs for the legacy `sceAgcGetRegisterDefaults`; compact 12-byte entries for `sceAgcGetRegisterDefaults2`, `...2Internal`, `...Internal` and `sceAgcInit`) is the same one #7681 merged as fea306dff7 shortly before this PR was opened (`RegisterDefaultsTypeLayout`, default `Compact`). So main already hands the compact entries to these callers, and the production part of this PR now conflicts with identical behaviour. Two parts are still worth having as a small follow-up on top of #7681: 1. **The tests:** `colourTargetBlock` with an entry-size parameter, checking MRT0 at block 78 and 73 through the *compact* v13 and v10 tables and walking versions 4-13. #7681 dropped those checks when the versioned tables stopped being pairs, so this would restore them for the new layout. 2. **The debt line** describing which entry point hands out which layout. Please leave the title ID out: the project's rule is that `docs/dev/debt` lines don't name titles. A description such as "SDK-built code walks the tables of the first two with a 12-byte stride…" says what's needed without it. Could you rebase onto main, drop the production hunks, and keep the tests and the debt text on #7681's `RegisterDefaultsTypeLayout`?
PhialsBasement commented 2026-10-19 01:40:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PhialsBasement on 2026-10-19T01:40:17Z.


Thanks, you're right that #7681 already does the split. Rebased onto main (b5be95ff0), dropped all production hunks, and kept only:

  • colourTargetBlock with an entry-size parameter, checking MRT0 at block 78 (legacy pairs and compact v13), block 73 (compact v10), and walking versions 4 to 13 on #7681's RegisterDefaultsTypeLayout.
  • The debt line naming each entry point's layout, without the title ID.

Title and description are updated to match.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6257834968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7692#issuecomment-6257834968). Originally posted by [PhialsBasement](https://github.com/PhialsBasement) on 2026-10-19T01:40:17Z. --- Thanks, you're right that #7681 already does the split. Rebased onto `main` (`b5be95ff0`), dropped all production hunks, and kept only: - `colourTargetBlock` with an entry-size parameter, checking MRT0 at block 78 (legacy pairs and compact v13), block 73 (compact v10), and walking versions 4 to 13 on #7681's `RegisterDefaultsTypeLayout`. - The debt line naming each entry point's layout, without the title ID. Title and description are updated to match.
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!7692
No description provided.