fix(agc): read initialized default context register ranges #20512

Merged
JJenkx merged 5 commits from upstream-pr/20512 into main 2026-12-01 21:00:46 +00:00
JJenkx commented 2026-11-15 07:55:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-15T07:55:06Z.


What

An empty sceAgcGetDefaultCxStateFlat(out, 4, 4, 0) request currently copies four bytes because the first register index is interpreted as a byte size. Correct the declaration and implementation to (destination, first, last, instance) and read the requested register interval from initialized sparse CX data.

Assemble public then internal CX records through the shared register-default views, keep the two version instances and their reuse/limit behavior, fill holes, and preserve the observed terminal-zero/untouched-tail behavior. Empty ranges and uninitialized instances leave output untouched. The source is the user-owned PPSA06652 bundled compatibility module; full platform initialization and host validation differences remain in debt.

Tested

Version-zero context correction: public 001429db701e, qualified on main 9e265ca0a454 as 1c5fa017d85b. An explicit occupied-slot bit separates version zero from an empty cache entry. The fresh-process regression checks all sparse version-zero context values and untouched output guards, preserves them after initializing a second version, rejects a third distinct version, and reuses both cached versions.

Matched control 27844b9d0b29:4 pass/1 expected failure, agc_initialization_zero (version-zero defaults were not constructed); change:5/5 pass. Both full SDK/relinker builds pass with SPIRV-Tools OFF. Each arm uses the same new fixture executables and differs only in the production context-occupancy logic. Same RX 6650 XT/RADV Mesa26.2.7 and validation1.4.363: one real validation insertion per arm, zero skips/VUIDs. Public-header syntax checks and conventions pass; each public+main tree exactly matches the qualified integration.

Both branches also merge cleanly with newer main 2a7f0786d2f4; AGC/driver sources are unchanged since the tested main.

The range-test diagnostic now reports36 reference-derived cases,3 empty null ranges and2 host-validation cases. Matched builds, verbose CTest/JUnit, exact source/fixture and binary manifests, SHA-256 d9bd3bb25237fb45bee98e1d1f70aa4fada7492e1cc04bd8c28b77cb1fef8de4 (downloaded and all65 payloads verified). No fresh native-title, Windows or NVIDIA result is claimed for these heads; previous evidence keeps its original pins.

Arch Linux; main 7079f1ae5e61, identical-fixture control 609e301b7695, change f31fbaea0fc6. Merged #20434 is already included through main; no pending dependency or merge commits.

  • Both full SDK/relinker builds pass: 834 control / 835 change frozen files, unchanged during qualification.
  • Same focused CTest gates: main 2 pass / 2 expected failures; change 4 pass. The identical public fixture has a compile-time adapter for main's old two-argument declaration. It checks empty/uninitialized/high ranges, actual public/internal CX data for versions 8/13, guards, reuse and the instance limit.
  • A separate raw ABI replay supplies all four arguments on both binaries, independent of that C++ adapter: 3 original static-contract mismatches → 0.
  • Additional change-only component gate: 39 bundled-leaf-derived cases plus 2 host-policy cases pass. The leaf was executed locally with synthetic backing data; its imported initialization chain and a console were not executed. This is not authenticated retail firmware or a fresh console measurement. No private binary/disassembly is attached.
  • Same real RX 6650 XT alpha-to-coverage gate on both arms with required Vulkan, no shader cache and validation 1.4.363 (headers 335). Both logs confirm physical-device selection and layer insertion; zero skips, missing layers or VUID errors. This is an unchanged GPU regression gate. No native-title, FPS or Windows claim; alternate Trinity profile remains untested.
  • Conventions and debt-fragment checks pass. Public-header declaration/umbrella audit passes for 413 libraries / 34553 exports. Official preflight checks 1541 open PRs; manual comparison resolves the fail-closed #17742/#19355/#19708 cases as separate suspend/draw/indirect-dispatch tests. Range registration is grouped beside context-state tests. Clean source-only merge against later main 93e73ccc8b14; that later tree was not executed.

Paired SDK/test logs, direct ABI replay, reference provenance and source patches, SHA-256 73520b56941c8622c2899685ad55912d8d0cc3ef82e9c5d7c24f985531002a25. Downloaded archive and all 54 members verified.

Contributor-reported Windows NVIDIA validation (not rerun here): head f31fbaea0f merged onto main b885c40a67 as c506117d26, RTX 4080 driver 32.0.16.2101, WinLibs GCC 15.2 Release. Baseline 1843 GPU-set passes versus 1844 with the change,0 failures/0 VUID lines,20 skipped on each; both changed tests pass. One upload-cache fixture was not built on either arm because of the main Windows setenv issue handled by #19899. Five 30-second homebrew rendering checks are reported with similar frame rates; those single runs are not a performance comparison. No commercial title was checked.

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 (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.7, Arch Linux; validation 1.4.363
  • AI-assisted: yes

Current-main refresh: 825ede7ed3b2 rebases the same four commits onto main e4caa07950f8; rebase_verify confirms every added/deleted line, file mode, author and commit is preserved. Fresh Linux full-SDK/relinker fixture build ba2089832a9f has exactly this production tree. The sparse-range fixture (39 reference-derived cases plus two host-policy cases), initialization, graphics and real RX 6650 XT alpha gate pass; the latter confirms validation insertion, physical device selection and zero skips/VUIDs. New queue-reset negative fixtures still fail on this prerequisite as expected; #21653 implements that separate correction and explicitly depends on this PR. Current-main build/test evidence, SHA-256 3d2c1343577483ce520a7cafa53916a3c78f361f98ccbcf753a3c665e9cbf40d (79 downloaded payloads verified). Earlier Windows evidence above remains tied to its recorded head; no new Windows run.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5320732651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20512). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-15T07:55:06Z. --- ### What An empty `sceAgcGetDefaultCxStateFlat(out, 4, 4, 0)` request currently copies four bytes because the first register index is interpreted as a byte size. Correct the declaration and implementation to `(destination, first, last, instance)` and read the requested register interval from initialized sparse CX data. Assemble public then internal CX records through the shared register-default views, keep the two version instances and their reuse/limit behavior, fill holes, and preserve the observed terminal-zero/untouched-tail behavior. Empty ranges and uninitialized instances leave output untouched. The source is the user-owned PPSA06652 bundled compatibility module; full platform initialization and host validation differences remain in debt. ### Tested **Version-zero context correction:** public `001429db701e`, qualified on main `9e265ca0a454` as `1c5fa017d85b`. An explicit occupied-slot bit separates version zero from an empty cache entry. The fresh-process regression checks all sparse version-zero context values and untouched output guards, preserves them after initializing a second version, rejects a third distinct version, and reuses both cached versions. Matched control `27844b9d0b29`:4 pass/1 expected failure, `agc_initialization_zero` (`version-zero defaults were not constructed`); change:5/5 pass. Both full SDK/relinker builds pass with SPIRV-Tools OFF. Each arm uses the same new fixture executables and differs only in the production context-occupancy logic. Same RX 6650 XT/RADV Mesa26.2.7 and validation1.4.363: one real validation insertion per arm, zero skips/VUIDs. Public-header syntax checks and conventions pass; each public+main tree exactly matches the qualified integration. Both branches also merge cleanly with newer main `2a7f0786d2f4`; AGC/driver sources are unchanged since the tested main. The range-test diagnostic now reports36 reference-derived cases,3 empty null ranges and2 host-validation cases. [Matched builds, verbose CTest/JUnit, exact source/fixture and binary manifests](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/agc-default-context-zero-dependencies-linux-20261117.tar.gz), SHA-256 `d9bd3bb25237fb45bee98e1d1f70aa4fada7492e1cc04bd8c28b77cb1fef8de4` (downloaded and all65 payloads verified). No fresh native-title, Windows or NVIDIA result is claimed for these heads; previous evidence keeps its original pins. Arch Linux; main `7079f1ae5e61`, identical-fixture control `609e301b7695`, change `f31fbaea0fc6`. Merged #20434 is already included through main; no pending dependency or merge commits. - Both full SDK/relinker builds pass: **834 control / 835 change frozen files**, unchanged during qualification. - Same focused CTest gates: **main 2 pass / 2 expected failures; change 4 pass**. The identical public fixture has a compile-time adapter for main's old two-argument declaration. It checks empty/uninitialized/high ranges, actual public/internal CX data for versions 8/13, guards, reuse and the instance limit. - A separate raw ABI replay supplies all four arguments on both binaries, independent of that C++ adapter: **3 original static-contract mismatches → 0**. - Additional change-only component gate: **39 bundled-leaf-derived cases plus 2 host-policy cases pass**. The leaf was executed locally with synthetic backing data; its imported initialization chain and a console were not executed. This is not authenticated retail firmware or a fresh console measurement. No private binary/disassembly is attached. - Same real RX 6650 XT alpha-to-coverage gate on both arms with required Vulkan, no shader cache and validation 1.4.363 (headers 335). Both logs confirm physical-device selection and layer insertion; **zero skips, missing layers or VUID errors**. This is an unchanged GPU regression gate. No native-title, FPS or Windows claim; alternate Trinity profile remains untested. - Conventions and debt-fragment checks pass. Public-header declaration/umbrella audit passes for **413 libraries / 34553 exports**. Official preflight checks **1541 open PRs**; manual comparison resolves the fail-closed #17742/#19355/#19708 cases as separate suspend/draw/indirect-dispatch tests. Range registration is grouped beside context-state tests. Clean source-only merge against later main `93e73ccc8b14`; that later tree was not executed. [Paired SDK/test logs, direct ABI replay, reference provenance and source patches](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/agc-default-cx-range-main7079-linux-20261115.tar.gz), SHA-256 `73520b56941c8622c2899685ad55912d8d0cc3ef82e9c5d7c24f985531002a25`. Downloaded archive and all **54 members verified**. <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> <!-- codex-contributor-validation-20261115 --> [Contributor-reported Windows NVIDIA validation](https://github.com/boykopovar/AnyPS5/pull/20512#issuecomment-6896761937) (not rerun here): head `f31fbaea0f` merged onto main `b885c40a67` as `c506117d26`, RTX 4080 driver 32.0.16.2101, WinLibs GCC 15.2 Release. Baseline 1843 GPU-set passes versus 1844 with the change,0 failures/0 VUID lines,20 skipped on each; both changed tests pass. One upload-cache fixture was not built on either arm because of the main Windows `setenv` issue handled by #19899. Five 30-second homebrew rendering checks are reported with similar frame rates; those single runs are not a performance comparison. No commercial title was checked. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.7, Arch Linux; validation 1.4.363 - [x] AI-assisted: yes <!-- current-main-rebase-20261116 --> Current-main refresh: `825ede7ed3b2` rebases the same four commits onto main `e4caa07950f8`; `rebase_verify` confirms every added/deleted line, file mode, author and commit is preserved. Fresh Linux full-SDK/relinker fixture build `ba2089832a9f` has exactly this production tree. The sparse-range fixture (39 reference-derived cases plus two host-policy cases), initialization, graphics and real RX 6650 XT alpha gate pass; the latter confirms validation insertion, physical device selection and zero skips/VUIDs. New queue-reset negative fixtures still fail on this prerequisite as expected; #21653 implements that separate correction and explicitly depends on this PR. [Current-main build/test evidence](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/agc-reset-context-maine4ca-linux-20261116.tar.gz), SHA-256 `3d2c1343577483ce520a7cafa53916a3c78f361f98ccbcf753a3c665e9cbf40d` (79 downloaded payloads verified). Earlier Windows evidence above remains tied to its recorded head; no new Windows run.
MarcZX10 commented 2026-11-15 08:32:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T08:32:18Z.

Review: APPROVED


Reviewed — looks good

The changed implementation and all files listed as reviewed were inspected at head f31fbaea0fc6cefd9c63280481bcdc70080558c9; no concrete defect was found in the requested range handling.

What I ran

No build or test commands were run. I inspected the prepared diff and targeted source with repo_read.py.

Results

Check Result Note
Diff and source review passed Nine included changed files read
Build and tests not run Test results in the PR description are author reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds, CTest gates, ABI replay, GPU gate, full platform initialization, Trinity mode, retail firmware behavior, and console behavior were not independently run or confirmed. The deleted debt fragment has no head text to read. files.json was not available through the review reader; the manifest lists nine included changed files and one deletion.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5909859738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20512#pullrequestreview-5909859738). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T08:32:18Z. **Review:** APPROVED --- # Reviewed — looks good The changed implementation and all files listed as reviewed were inspected at head `f31fbaea0fc6cefd9c63280481bcdc70080558c9`; no concrete defect was found in the requested range handling. ## What I ran No build or test commands were run. I inspected the prepared diff and targeted source with `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Diff and source review | passed | Nine included changed files read | | Build and tests | not run | Test results in the PR description are author reported | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Builds, CTest gates, ABI replay, GPU gate, full platform initialization, Trinity mode, retail firmware behavior, and console behavior were not independently run or confirmed. The deleted debt fragment has no head text to read. `files.json` was not available through the review reader; the manifest lists nine included changed files and one deletion. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-23 05:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T05:22:07Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 001429db701e780d75b5b607824174ea48825f14 using repo_read.py to inspect the prepared diff and repository source. No build or test commands were run; reported test results are author supplied.

Results

Check Result Note
Changed source review passed All included changed files read
Build and tests not run Results in the description were not independently verified
Repository context passed Checked relevant callers and test registration

Findings

Blocking

None.

Non-blocking

  • The range-copy loop writes one zero and stops after it reaches the end of the initialized register list (core/libs/prx/libSceAgc/Command/src/RegisterDefaults.cpp:159-163). The existing tests assert this terminal-zero behavior, and the change description says it is intended. Since that behavior is based on the bundled compatibility module and the full platform initialization path is not reproduced, confirming it against another authoritative reference would strengthen confidence.

Not verified

  • Builds, tests, physical-console behavior, and alternate Trinity profile were not run or independently confirmed. The description reports Linux and Windows results, but these remain author supplied.
  • Read all files listed as reviewed in manifest.json: core/libs/prx/libSceAgc/CMakeLists.txt, core/libs/prx/libSceAgc/Command/include/RegisterDefaults.hpp, core/libs/prx/libSceAgc/Command/src/RegisterDefaults.cpp, core/libs/prx/libSceAgc/DcbState/src/Init.cpp, core/libs/prx/libSceAgc/Misc/include/RegisterDefaults.hpp, core/libs/prx/libSceAgc/Misc/src/RegisterDefaults.cpp, core/libs/prx/libSceAgc/tests/Commands.cpp, core/libs/prx/libSceAgc/tests/DefaultCxStateRange.cpp, and docs/dev/debt/changes/fix-agc-default-context-range-reader-20261115.md.
  • The deleted debt fragment has no new text to read; files.json was not available through the reader.

To get this to a good state

Nothing is required. Optional: add independent authoritative evidence for terminal-zero behavior when available.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6016900443 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20512#pullrequestreview-6016900443). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T05:22:07Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `001429db701e780d75b5b607824174ea48825f14` using `repo_read.py` to inspect the prepared diff and repository source. No build or test commands were run; reported test results are author supplied. ## Results | Check | Result | Note | |---|---|---| | Changed source review | passed | All included changed files read | | Build and tests | not run | Results in the description were not independently verified | | Repository context | passed | Checked relevant callers and test registration | ## Findings ### Blocking None. ### Non-blocking - The range-copy loop writes one zero and stops after it reaches the end of the initialized register list (`core/libs/prx/libSceAgc/Command/src/RegisterDefaults.cpp:159-163`). The existing tests assert this terminal-zero behavior, and the change description says it is intended. Since that behavior is based on the bundled compatibility module and the full platform initialization path is not reproduced, confirming it against another authoritative reference would strengthen confidence. ## Not verified - Builds, tests, physical-console behavior, and alternate Trinity profile were not run or independently confirmed. The description reports Linux and Windows results, but these remain author supplied. - Read all files listed as reviewed in `manifest.json`: `core/libs/prx/libSceAgc/CMakeLists.txt`, `core/libs/prx/libSceAgc/Command/include/RegisterDefaults.hpp`, `core/libs/prx/libSceAgc/Command/src/RegisterDefaults.cpp`, `core/libs/prx/libSceAgc/DcbState/src/Init.cpp`, `core/libs/prx/libSceAgc/Misc/include/RegisterDefaults.hpp`, `core/libs/prx/libSceAgc/Misc/src/RegisterDefaults.cpp`, `core/libs/prx/libSceAgc/tests/Commands.cpp`, `core/libs/prx/libSceAgc/tests/DefaultCxStateRange.cpp`, and `docs/dev/debt/changes/fix-agc-default-context-range-reader-20261115.md`. - The deleted debt fragment has no new text to read; `files.json` was not available through the reader. ## To get this to a good state Nothing is required. Optional: add independent authoritative evidence for terminal-zero behavior when available.
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!20512
No description provided.