feat(ngs2): route custom submixer buffers through Gain #10851

Merged
Felipebmaitan merged 7 commits from upstream-pr/10851 into main 2026-10-26 21:55:08 +00:00
Felipebmaitan commented 2026-10-25 05:03:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-25T05:03:27Z.


What

Custom submixers currently use one sample buffer for inputs, output ports and Gain. Add 1-4 per-voice buffers for custom submixers with zero modules or one Gain stage: inputs feed matching buffers, each grain clears unwritten samples, ports select their configured source, and Gain overwrites its selected destination. Broader chains and module routing stay unsupported until their processing-order contract is established.

Correct Gain's 37 unclamped levels, previous-level i/N ramps, equal-gain fast path, steady zero clearing and steady unity copying. Invalid Gain positions return 0x804A835A and stop linked parameter processing. Contracts follow the PS5 12.70 module report and later findings; KytyPS5 corroborates port selection. No new console measurement is claimed.

Unverified Gain initialization/lifecycle, callback setup/route changes and nonfinite integer rendering retain their runtime refusals and debt entries. Sampler Gain, broader custom chains and channel conversion remain outside this milestone. Tests exercise supported operations rather than requiring unimplemented cases to keep throwing.

Dean's requested follow-up is implemented at c40ba98945e845b950ecca7819c472942757ad30. Merged main 9b520147fbeddff4357d6e8f92e5235a16342171 in 0c3f104067239abd5358b8d1992295f9da7b27ee; then removed the unsupported exception assertions. CustomSafety keeps ordinary custom/upstream callbacks, explicitly configured Gain, route changes before rendering, callback counts, port metadata and literal output checks in both libraries. Gain keeps finite integer controls and its float/numeric/ramp coverage. Ngs2Custom's supported coverage is retained.

The earlier proposed queue's #9926, #10127 and #10410 are now in main, including #10410's PCM-fixture lifetime repair. The merge preserves their PLAY/list-error propagation, PCM widths/accounting, mastering gain and all tests alongside this PR's Gain early errors and callback safeguards. No open prerequisite is required.

#11352 independently proposes the same Gain-ramp correction already included here; apply that correction once and preserve the combined coverage whichever PR lands first. Custom Reverb #10599, experimental PCM retention #5548, and newer custom-module/channel/codec work remain separate. Their later compositions must preserve each topic's scope, state ownership and test registrations and be validated at their actual heads. The refreshed overlap report and independent reviews record current pinned references; no sibling branch was edited or combined-runtime result claimed.

Tested

Windows 11 Pro 10.0.26200; WinLibs MinGW-w64 GCC 15.2.0 r7; Ninja Release, BUILD_TESTING=ON, SPIRV-Tools enabled. Latest exact head: c40ba98945e845b950ecca7819c472942757ad30, main ancestor 9b520147fbeddff4357d6e8f92e5235a16342171.

  • Reconfigured the existing isolated full-build tree and rebuilt both production NGS2 library targets plus all 22 focused test executables with cmake --build build --target <both libraries and NGS2 test targets> --parallel 2.
  • ctest --test-dir build -R '^ngs2_' --output-on-failure --parallel 2: 30/30 passed, zero skips, 2.95 seconds. This includes all ten supported CustomSafety cases, Gain/Routing against both libraries, native/core PCM and native voice events.
  • Retained literal/rational expectations for previous-level ramps, target replacement, channel/voice independence, pause/resume, grain changes, levels outside +/-32, float nonfinite classifications, finite integer output, invalid module positions/list termination, all supported channel layouts, 1-4 buffers, overwrite/aliasing, per-grain clearing and separate-buffer unity copying.
  • python -B tools/check_conventions.py --base origin/main and exact-base whitespace checks pass. python -B core/libs/tests/test_public_headers.py --audit-only: 368 libraries/12,231 exports verified; this is a declaration audit, not a compiled-header run.
  • Fresh independent GPT-6.1-Sol/xhigh macro and micro reviews at this exact head found no actionable candidate defect and confirmed this fulfills Dean's requested scope. They performed source/artifact checks; the exact-head runtime results above are parent-run.

The former unsupported-refusal tests and their historical mutation results are not retained-test evidence. No new title, GPU, original-module or PS5 run was performed for this follow-up. The earlier a43a610 production smoke reached a capped Dead Cells loading screen; it establishes no latest-head title result, audio fidelity, callback timing, GPU validation or performance. Full-suite/hosted runtime checks and unselected external compositions are not claimed.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5001978101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10851). Originally posted by [Felipebmaitan](https://github.com/Felipebmaitan) on 2026-10-25T05:03:27Z. --- ### What Custom submixers currently use one sample buffer for inputs, output ports and Gain. Add 1-4 per-voice buffers for custom submixers with zero modules or one Gain stage: inputs feed matching buffers, each grain clears unwritten samples, ports select their configured source, and Gain overwrites its selected destination. Broader chains and module routing stay unsupported until their processing-order contract is established. Correct Gain's 37 unclamped levels, previous-level `i/N` ramps, equal-gain fast path, steady zero clearing and steady unity copying. Invalid Gain positions return `0x804A835A` and stop linked parameter processing. Contracts follow [the PS5 12.70 module report](https://github.com/boykopovar/AnyPS5/issues/8039#issuecomment-6319332943) and [later findings](https://github.com/boykopovar/AnyPS5/issues/8039#issuecomment-6391072574); [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/83f8bfd3c9c35fcb135ef6c33dfd88bbfe066ee2/src/libs/ngs2.cpp#L417-L419) corroborates port selection. No new console measurement is claimed. Unverified Gain initialization/lifecycle, callback setup/route changes and nonfinite integer rendering retain their runtime refusals and debt entries. Sampler Gain, broader custom chains and channel conversion remain outside this milestone. Tests exercise supported operations rather than requiring unimplemented cases to keep throwing. Dean's [requested follow-up](https://github.com/boykopovar/AnyPS5/pull/10851#issuecomment-6409302040) is implemented at `c40ba98945e845b950ecca7819c472942757ad30`. Merged main `9b520147fbeddff4357d6e8f92e5235a16342171` in `0c3f104067239abd5358b8d1992295f9da7b27ee`; then removed the unsupported exception assertions. CustomSafety keeps ordinary custom/upstream callbacks, explicitly configured Gain, route changes before rendering, callback counts, port metadata and literal output checks in both libraries. Gain keeps finite integer controls and its float/numeric/ramp coverage. Ngs2Custom's supported coverage is retained. The earlier proposed queue's #9926, #10127 and #10410 are now in main, including #10410's PCM-fixture lifetime repair. The merge preserves their PLAY/list-error propagation, PCM widths/accounting, mastering gain and all tests alongside this PR's Gain early errors and callback safeguards. No open prerequisite is required. #11352 independently proposes the same Gain-ramp correction already included here; apply that correction once and preserve the combined coverage whichever PR lands first. Custom Reverb #10599, experimental PCM retention #5548, and newer custom-module/channel/codec work remain separate. Their later compositions must preserve each topic's scope, state ownership and test registrations and be validated at their actual heads. The refreshed overlap report and independent reviews record current pinned references; no sibling branch was edited or combined-runtime result claimed. ### Tested Windows 11 Pro 10.0.26200; WinLibs MinGW-w64 GCC 15.2.0 r7; Ninja Release, BUILD_TESTING=ON, SPIRV-Tools enabled. Latest exact head: `c40ba98945e845b950ecca7819c472942757ad30`, main ancestor `9b520147fbeddff4357d6e8f92e5235a16342171`. - Reconfigured the existing isolated full-build tree and rebuilt both production NGS2 library targets plus all 22 focused test executables with `cmake --build build --target <both libraries and NGS2 test targets> --parallel 2`. - `ctest --test-dir build -R '^ngs2_' --output-on-failure --parallel 2`: **30/30 passed**, zero skips, 2.95 seconds. This includes all ten supported CustomSafety cases, Gain/Routing against both libraries, native/core PCM and native voice events. - Retained literal/rational expectations for previous-level ramps, target replacement, channel/voice independence, pause/resume, grain changes, levels outside +/-32, float nonfinite classifications, finite integer output, invalid module positions/list termination, all supported channel layouts, 1-4 buffers, overwrite/aliasing, per-grain clearing and separate-buffer unity copying. - `python -B tools/check_conventions.py --base origin/main` and exact-base whitespace checks pass. `python -B core/libs/tests/test_public_headers.py --audit-only`: 368 libraries/12,231 exports verified; this is a declaration audit, not a compiled-header run. - Fresh independent GPT-6.1-Sol/xhigh macro and micro reviews at this exact head found no actionable candidate defect and confirmed this fulfills Dean's requested scope. They performed source/artifact checks; the exact-head runtime results above are parent-run. The former unsupported-refusal tests and their historical mutation results are not retained-test evidence. No new title, GPU, original-module or PS5 run was performed for this follow-up. The earlier a43a610 production smoke reached a capped Dead Cells loading screen; it establishes no latest-head title result, audio fidelity, callback timing, GPU validation or performance. Full-suite/hosted runtime checks and unselected external compositions are not claimed. <!-- 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. --> ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-25 05:12:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T05:12:35Z.

Review: COMMENTED


Reviewed the exact-head follow-up e50cbf349d4e0af8647627640df9c8c9ddf610b7 against a43a610bbf8a8c5b9e7499dd2631247a8597a551. This follow-up is test-only: callback safety cases now require the exact refusal and a single callback invocation, and the integer-output case checks finite positive/negative gain plus nonfinite rejection with output sentinels unchanged. I found no issue in these added assertions. I did not build or run them locally; the 27/27 NGS2 results in the description are author-reported. This is not a full review or approval of the composed change: the PR remains draft while overlap owners coordinate, and the body says no combined branch has been validated.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641681863 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10851#pullrequestreview-5641681863). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T05:12:35Z. **Review:** COMMENTED --- Reviewed the exact-head follow-up `e50cbf349d4e0af8647627640df9c8c9ddf610b7` against `a43a610bbf8a8c5b9e7499dd2631247a8597a551`. This follow-up is test-only: callback safety cases now require the exact refusal and a single callback invocation, and the integer-output case checks finite positive/negative gain plus nonfinite rejection with output sentinels unchanged. I found no issue in these added assertions. I did not build or run them locally; the 27/27 NGS2 results in the description are author-reported. This is not a full review or approval of the composed change: the PR remains draft while overlap owners coordinate, and the body says no combined branch has been validated.
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!10851
No description provided.