fix(libSceNgs2.native): accept a reverb voice with different input and output channel counts #10347

Merged
hugodearaujo merged 3 commits from upstream-pr/10347 into main 2026-10-24 12:53:08 +00:00
hugodearaujo commented 2026-10-23 18:33:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-23T18:33:03Z.


What

SCE_NGS2_REVERB_VOICE_PARAM_SETUP throws NGS2: reverb channel conversion is not implemented when num_input_channels differs from num_output_channels. The Elder Scrolls V: Skyrim (PPSA03747) sets up its reverb voice with 2 inputs and 8 outputs 19 s into boot, so it stops there.

This PR accepts the conversion:

  • A reverb voice keeps its input count apart from its output count (Ngs2Voice::inputChannels; 0 means the output count, for every other voice). Ports into the voice mix in the input layout, through their matrix or the default channel map.
  • The wet path only needs the two counts. Since e15f1644e3 the reverb folds its input to mono with the PS4 library's fixed gains, and runs its comb selection and allpasses per output channel. The fold now uses the input count, and those stages run for each output channel.
  • The dry signal reaches the output layout through the default channel map. That's the part not checked against the PS4 library, and the new debt entry says so. A stereo input keeps its dry signal on the front left and right, and the other outputs carry only the reverb.
  • Both counts must be 1, 2, 6 or 8 and within the rack's max_channels, as the output count already had to be.

@JAB-dev, your reverb was checked against the PS4 library's output. If your setup can render a 2-in, 8-out voice, that would settle the dry path. #1384, a draft from before e15f1644e3, also kept a separate input count, on its own reverb.

Tested

  • Skyrim (PPSA03747 01.001.010), Linux, RX 9070 XT with RADV (Mesa 26.2.5), Release, X pressed every 30 s:
    • main 65ac1d3b50 (with #8091, which I run for host imports; it doesn't touch NGS2) stops at 19 s with NGS2: reverb channel conversion is not implemented.
    • main 65ac1d3b50 with this PR (and no #8091) sets the voice up with 2 inputs and 8 outputs. It reaches the main menu, and New Game reaches its loading screen. At 155 s it stops on a separate graphics refusal, guest cube texture descriptor holds fewer than 6 array slices (format 71, 512x512x5, ...).
  • ngs2_render and ngs2_core_render, in Ngs2Render.cpp:
    • TestReverbConversion: a 2-in, 6-out voice and a 2-in, 8-out voice (the title's layout) give the same front left and right as a 2-in, 2-out voice on the same input, wet and dry. Their centre, surrounds and backs carry the reverb, and their LFE stays silent. With the wet level at 0, a 6-in, 2-out voice gives L + C * sqrt(2)/2 + Ls/2 and R + C * sqrt(2)/2 + Rs/2.
    • TestReverbSetup: 1 input and 2 outputs is accepted. Input or output counts of 3 or 7 are rejected with the invalid-argument error, as equal counts of 3, 4, 5 and 7 already were.
    • Red: with main's Voice.cpp, both executables abort with NGS2: reverb channel conversion is not implemented.
  • All 13 ngs2_* tests pass. Linux (Arch, kernel 7.2.11), GCC 16.2.1, Release.
  • tools/check_conventions.py passes.
  • Not tested on Windows or macOS.

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: PPSA03747 (no Game bring-up discussion yet)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4987534774 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10347). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-23T18:33:03Z. --- ### What `SCE_NGS2_REVERB_VOICE_PARAM_SETUP` throws `NGS2: reverb channel conversion is not implemented` when `num_input_channels` differs from `num_output_channels`. The Elder Scrolls V: Skyrim (PPSA03747) sets up its reverb voice with 2 inputs and 8 outputs 19 s into boot, so it stops there. This PR accepts the conversion: - A reverb voice keeps its input count apart from its output count (`Ngs2Voice::inputChannels`; 0 means the output count, for every other voice). Ports into the voice mix in the input layout, through their matrix or the default channel map. - The wet path only needs the two counts. Since e15f1644e3 the reverb folds its input to mono with the PS4 library's fixed gains, and runs its comb selection and allpasses per output channel. The fold now uses the input count, and those stages run for each output channel. - The dry signal reaches the output layout through the default channel map. That's the part not checked against the PS4 library, and the new debt entry says so. A stereo input keeps its dry signal on the front left and right, and the other outputs carry only the reverb. - Both counts must be 1, 2, 6 or 8 and within the rack's `max_channels`, as the output count already had to be. @JAB-dev, your reverb was checked against the PS4 library's output. If your setup can render a 2-in, 8-out voice, that would settle the dry path. #1384, a draft from before e15f1644e3, also kept a separate input count, on its own reverb. ### Tested - **Skyrim (PPSA03747 01.001.010)**, Linux, RX 9070 XT with RADV (Mesa 26.2.5), Release, X pressed every 30 s: - `main` 65ac1d3b50 (with #8091, which I run for host imports; it doesn't touch NGS2) stops at 19 s with `NGS2: reverb channel conversion is not implemented`. - `main` 65ac1d3b50 with this PR (and no #8091) sets the voice up with 2 inputs and 8 outputs. It reaches the main menu, and New Game reaches its loading screen. At 155 s it stops on a separate graphics refusal, `guest cube texture descriptor holds fewer than 6 array slices (format 71, 512x512x5, ...)`. - **`ngs2_render` and `ngs2_core_render`**, in `Ngs2Render.cpp`: - `TestReverbConversion`: a 2-in, 6-out voice and a 2-in, 8-out voice (the title's layout) give the same front left and right as a 2-in, 2-out voice on the same input, wet and dry. Their centre, surrounds and backs carry the reverb, and their LFE stays silent. With the wet level at 0, a 6-in, 2-out voice gives `L + C * sqrt(2)/2 + Ls/2` and `R + C * sqrt(2)/2 + Rs/2`. - `TestReverbSetup`: 1 input and 2 outputs is accepted. Input or output counts of 3 or 7 are rejected with the invalid-argument error, as equal counts of 3, 4, 5 and 7 already were. - Red: with `main`'s `Voice.cpp`, both executables abort with `NGS2: reverb channel conversion is not implemented`. - All 13 `ngs2_*` tests pass. Linux (Arch, kernel 7.2.11), GCC 16.2.1, Release. - `tools/check_conventions.py` passes. - Not tested on Windows or macOS. ### 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 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: PPSA03747 (no Game bring-up discussion yet) - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 19:09:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:09:55Z.

Review: APPROVED


Reviewed the channel-layout path through MixPort, RenderVoice and Ngs2ProcessReverb. The new input count is used for port mixing and the wet mono fold, while output channel state continues to drive the comb/allpass stages; the dry path is remapped before the output channels are processed. The tests cover unequal counts in both directions, input/output validation, wet output distribution and dry downmix, and the author reports the exact Skyrim setup reaching the menu/loading screen. The open #1384 draft is explicitly distinct: it contains the older experimental reverb and itself records that a rework must preserve main’s reference-checked DSP; this PR does preserve that DSP and adds the missing channel conversion. One useful follow-up would be a focused 2-in/8-out render assertion for the exact title layout. The unverified dry mapping is recorded in technical debt. Hosted eligibility, conventions, intake, labels and report checks pass; product jobs are skipped by path policy. I found no blocking issue in this scope.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5633256381 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10347#pullrequestreview-5633256381). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T19:09:55Z. **Review:** APPROVED --- Reviewed the channel-layout path through `MixPort`, `RenderVoice` and `Ngs2ProcessReverb`. The new input count is used for port mixing and the wet mono fold, while output channel state continues to drive the comb/allpass stages; the dry path is remapped before the output channels are processed. The tests cover unequal counts in both directions, input/output validation, wet output distribution and dry downmix, and the author reports the exact Skyrim setup reaching the menu/loading screen. The open #1384 draft is explicitly distinct: it contains the older experimental reverb and itself records that a rework must preserve main’s reference-checked DSP; this PR does preserve that DSP and adds the missing channel conversion. One useful follow-up would be a focused 2-in/8-out render assertion for the exact title layout. The unverified dry mapping is recorded in technical debt. Hosted eligibility, conventions, intake, labels and report checks pass; product jobs are skipped by path policy. I found no blocking issue in this scope.
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!10347
No description provided.