feat(ngs2): copy custom UserFx source to dest across multiple buffers #12673

Merged
2Swagger merged 6 commits from upstream-pr/12673 into main 2026-11-03 22:25:59 +00:00
2Swagger commented 2026-10-29 01:20:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 2Swagger on 2026-10-29T01:20:30Z.


Stacked on #10599: this diff includes #10599's commits until it merges. This PR's own changes are commits bdc7af81b and c17c71e4d.

What

A custom submixer (0x4002) with more than one buffer accepted at most one Gain module; anything else threw NGS2: multiple custom buffers require a submixer with at most one Gain module. BLUE REFLECTION Quartet (PPSA33655, #10271) stops there once #10599 lets its Reverb rack through. The rack it is refused on has 2 buffers, 2 inputs and two UserFx 0x19 modules, the second taking buffer 1 as its extra buffer (JJenkx's rack dump).

This PR follows item 4 of fma-rc's reading of the PS5 12.70 module, the reading debt entry "NGS2 custom buffers" already cites for input routing:

  • A UserFx 0x19 module copies its source buffer over its dest buffer. With a handler, the handler runs on the source in place. Without one, the copy is all that happens.
  • A multi-buffer submixer now accepts Gain and UserFx 0x19 modules. Any other module still throws, naming its id, and multi-buffer racks other than the submixer still throw.

Two handler gaps still throw. The reading says the extra buffer's channel pointers are appended after the source's, but two things it does not say would be guesses:

  1. Whether the handler is then told the source's channel count or the total.
  2. Whether extra_buffer_id 0 means "no extra buffer". Item 13 says buffer 1 is handed over as extra when none is given and the rack has more buffers.

So a UserFx handler in a multi-buffer submixer throws, naming both gaps. The game's rack needs both: its first module has extra 0, its second extra 1. It now stops at its next rack instead (see Tested). I've asked JJenkx on #10271 about these two details and the module order, and whether they can test this branch with the title.

Side effect: the old check also refused any multi-buffer chain with more than one module. Several Gains, or a Gain plus a UserFx, are now accepted in a multi-buffer submixer. They run in list order, as single-buffer chains already do and as item 16 describes. Reordering by voice control is unverified.

The debt entry "NGS2 custom buffers" in docs/dev/debt/libSceNgs2.native.md now records:

  • the accepted modules;
  • item 4's copy, cited to the reading;
  • the two handler gaps, with PPSA33655 named as needing both;
  • list order (item 16), with reordering by voice control unverified.

Tested

  • New TestCustomUserFxBuffers in ngs2_custom: a 2-input submixer with a UserFx module that has no handler, reading buffer 1 and writing buffer 0. Input 0 plays 0.5 and input 1 plays 0.25; the output port reads buffer 0. The output is exactly 0.25 on both channels for 2 grains, after the sampler's 3-sample startup delay at the start of the first grain. Before this change the test aborts with the old multiple custom buffers message.
  • Existing tests unchanged: ngs2_userfx, ngs2_gain, ngs2_routing, ngs2_customreverb and the five ngs2_custom_safety_* cases all pass, so single-buffer UserFx and Gain behaviour is unchanged.
  • Windows 11 (WinLibs GCC 15.2.0, Release), head c17c71e4d (on #10599 at bc0711398, merged onto main cf0e33b6a): those 10 tests plus public_headers and its compile batches, 75 of 75 passed.
  • Linux (Ubuntu 24.04 under WSL2, GCC 13.3.0, Release): the same 75 of 75 passed.
  • Repeats: ngs2_custom, ngs2_userfx and ngs2_custom_safety_routing_two_buffers passed 20 consecutive runs each on both platforms (ctest --repeat until-fail:20) at this head, and 200 each at bdc7af81b.
  • BLUE REFLECTION Quartet (PPSA33655): JJenkx ran it on main 602c0e417c with this PR merged in (head c17c71e4d), on Linux with a Radeon RX 6650 XT (RADV, Mesa 26.2.4). The rack 3 refusal (multiple custom buffers require a submixer with at most one Gain module) is gone, so the title gets past rack 3. It now stops in the same second at its next rack, a custom mastering rack (0x4003) with modules 0x17 and 0x18: custom mastering racks with modules are not implemented. No audio renders yet, so the two UserFx handler gaps (the channel count with extra-buffer channels appended, and whether extra buffer 0 means none) remain unverified.
  • Conventions and test registration pass. Not tested on a console.

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: #10599
  • Fixes: none
  • Unblocks: PPSA33655 #10271
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5060411695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12673). Originally posted by [2Swagger](https://github.com/2Swagger) on 2026-10-29T01:20:30Z. --- Stacked on #10599: this diff includes #10599's commits until it merges. This PR's own changes are commits bdc7af81b and c17c71e4d. ### What A custom submixer (`0x4002`) with more than one buffer accepted at most one Gain module; anything else threw `NGS2: multiple custom buffers require a submixer with at most one Gain module`. BLUE REFLECTION Quartet (PPSA33655, #10271) stops there once #10599 lets its Reverb rack through. The rack it is refused on has 2 buffers, 2 inputs and two UserFx `0x19` modules, the second taking buffer 1 as its extra buffer ([JJenkx's rack dump](https://github.com/boykopovar/AnyPS5/pull/10599#issuecomment-6443996849)). This PR follows item 4 of fma-rc's [reading of the PS5 12.70 module](https://github.com/boykopovar/AnyPS5/issues/8039#issuecomment-6391072574), the reading debt entry "NGS2 custom buffers" already cites for input routing: - A UserFx `0x19` module copies its source buffer over its dest buffer. With a handler, the handler runs on the source in place. Without one, the copy is all that happens. - A multi-buffer submixer now accepts Gain and UserFx `0x19` modules. Any other module still throws, naming its id, and multi-buffer racks other than the submixer still throw. **Two handler gaps still throw.** The reading says the extra buffer's channel pointers are appended after the source's, but two things it does not say would be guesses: 1. Whether the handler is then told the source's channel count or the total. 2. Whether `extra_buffer_id` 0 means "no extra buffer". Item 13 says buffer 1 is handed over as extra when none is given and the rack has more buffers. So a UserFx handler in a multi-buffer submixer throws, naming both gaps. The game's rack needs both: its first module has extra 0, its second extra 1. It now stops at its next rack instead (see Tested). I've asked JJenkx on [#10271](https://github.com/boykopovar/AnyPS5/discussions/10271#discussioncomment-19256726) about these two details and the module order, and whether they can test this branch with the title. **Side effect:** the old check also refused any multi-buffer chain with more than one module. Several Gains, or a Gain plus a UserFx, are now accepted in a multi-buffer submixer. They run in list order, as single-buffer chains already do and as item 16 describes. Reordering by voice control is unverified. The debt entry "NGS2 custom buffers" in `docs/dev/debt/libSceNgs2.native.md` now records: - the accepted modules; - item 4's copy, cited to the reading; - the two handler gaps, with PPSA33655 named as needing both; - list order (item 16), with reordering by voice control unverified. ### Tested - **New `TestCustomUserFxBuffers` in `ngs2_custom`:** a 2-input submixer with a UserFx module that has no handler, reading buffer 1 and writing buffer 0. Input 0 plays 0.5 and input 1 plays 0.25; the output port reads buffer 0. The output is exactly 0.25 on both channels for 2 grains, after the sampler's 3-sample startup delay at the start of the first grain. Before this change the test aborts with the old `multiple custom buffers` message. - **Existing tests unchanged:** `ngs2_userfx`, `ngs2_gain`, `ngs2_routing`, `ngs2_customreverb` and the five `ngs2_custom_safety_*` cases all pass, so single-buffer UserFx and Gain behaviour is unchanged. - **Windows 11** (WinLibs GCC 15.2.0, Release), head c17c71e4d (on #10599 at bc0711398, merged onto `main` cf0e33b6a): those 10 tests plus `public_headers` and its compile batches, 75 of 75 passed. - **Linux** (Ubuntu 24.04 under WSL2, GCC 13.3.0, Release): the same 75 of 75 passed. - **Repeats:** `ngs2_custom`, `ngs2_userfx` and `ngs2_custom_safety_routing_two_buffers` passed 20 consecutive runs each on both platforms (`ctest --repeat until-fail:20`) at this head, and 200 each at bdc7af81b. - **BLUE REFLECTION Quartet (PPSA33655):** [JJenkx ran it](https://github.com/boykopovar/AnyPS5/discussions/10271#discussioncomment-19313059) on `main` 602c0e417c with this PR merged in (head c17c71e4d), on Linux with a Radeon RX 6650 XT (RADV, Mesa 26.2.4). The rack 3 refusal (`multiple custom buffers require a submixer with at most one Gain module`) is gone, so the title gets past rack 3. It now stops in the same second at its next rack, a custom mastering rack (0x4003) with modules 0x17 and 0x18: `custom mastering racks with modules are not implemented`. No audio renders yet, so the two UserFx handler gaps (the channel count with extra-buffer channels appended, and whether extra buffer 0 means none) remain unverified. - Conventions and test registration pass. Not tested on a console. ### 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: #10599 - [x] Fixes: none - [x] Unblocks: PPSA33655 #10271 - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
rooklz commented 2026-10-29 04:43:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T04:43:20Z.

Review: COMMENTED


I ran this PR's own commit (bdc7af81b) outside CMake on macOS: x86_64, Apple clang, ASan+UBSan. The build used the PR tree's libSceNgs2.native/src/*.cpp with a stub for the five Atrac9 entry points, linked against each test.

Results

  • On head, ngs2_custom passes (1.2 s). So do ngs2_customreverb, ngs2_gain, ngs2_routing, ngs2_userfx and all five ngs2_custom_safety_* cases.
  • With the pre-commit Custom.cpp (bdc7af81b^) and the new test, the run aborts with NGS2: multiple custom buffers require a submixer with at most one Gain module. That matches the body.
  • git merge-tree with current main (52c09d567d) is clean, and check_conventions --head passes.

Mutants (each one applied to Custom.cpp, then all 10 ngs2 tests run)

mutant killed by
drop CopyCustomBuffer TestCustomUserFxBuffers
swap source/dest TestCustomUserFxBuffers
add instead of copy TestCustomUserFxBuffers
copy only half the buffer TestCustomUserFxBuffers
accept any module id in a multi-buffer submixer TestCustomRackChecks L222
also accept UserFx2 0x1a there TestCustomRackChecks L222
drop the "handler in a multi-buffer submixer" throw survives all 10
drop the "multiple buffers outside a custom submixer" throw survives all 10
drop RefreshHasSamples in CopyCustomBuffer survives (looks equivalent: input mixing already set hasSamples, so a copy can only make it over-report)
drop the size-mismatch throw survives (equivalent: Render.cpp L301-302 sizes every buffer grain * InputChannels())

The two guards the body depends on ("Two handler gaps still throw", and multi-buffer racks other than the submixer still throw) aren't tested yet. The rows below go at the end of TestCustomUserFxBuffers, reusing the file's ProcessLegacy/LegacyUserFxState and CreateSamplerThrows. They kill both mutants: the handler mutant fails at L615 (the handler gets called) and the rack mutant at L892. Head still passes in 0.09 s.

--- a/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp
+++ b/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp
@@ -869,7 +869,27 @@
     for (int grain = 0; grain < 2; grain++) {
         const auto out = Render(system);
         for (std::uint32_t i = 0; i < Grain; i++) Require(out[i * 2] == 0.25f && out[i * 2 + 1] == 0.25f);
+    }
+
+    LegacyUserFxState state{};
+    Control(custom, SCE_NGS2_CUSTOM_VOICE_PARAM_USER_FX | 0, Ngs2CustomVoiceUserFxParam{{}, ProcessLegacy, reinterpret_cast<std::uintptr_t>(&state), 0, 0});
+    bool threw = false;
+    try {
+        Render(system);
+    } catch (const std::runtime_error&) {
+        threw = true;
     }
+    Require(threw && state.calls == 0);
+
+    Ngs2CustomSamplerRackOption sampler{};
+    sampler.custom_rack_option.rack_option.size = sizeof(sampler);
+    sampler.custom_rack_option.rack_option.max_grain_samples = 512;
+    sampler.custom_rack_option.rack_option.max_voices = 1;
+    sampler.custom_rack_option.rack_option.max_matrices = 1;
+    sampler.custom_rack_option.rack_option.max_ports = 1;
+    sampler.custom_rack_option.num_buffers = 2;
+    sampler.max_channel_works = 1;
+    Require(CreateSamplerThrows<std::runtime_error>(sampler));
 
     Require(sceNgs2RackDestroy(rack, nullptr) == SCE_NGS2_OK);
     Require(sceNgs2SystemDestroy(system, nullptr) == SCE_NGS2_OK);

The sampler row hits the new outside a custom submixer branch, since a 0-module custom sampler with 2 buffers passes every earlier check. If you'd rather cover the mastering rack too, the same row with MasteringRackOption(2, 1) and num_buffers = 2 should reach the same branch. I didn't run that one.

Source and host tests only; nothing on a console, and I didn't use PPSA33655.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692955045 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12673#pullrequestreview-5692955045). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-29T04:43:20Z. **Review:** COMMENTED --- I ran this PR's own commit (bdc7af81b) outside CMake on macOS: x86_64, Apple clang, ASan+UBSan. The build used the PR tree's `libSceNgs2.native/src/*.cpp` with a stub for the five Atrac9 entry points, linked against each test. **Results** - On head, `ngs2_custom` passes (1.2 s). So do `ngs2_customreverb`, `ngs2_gain`, `ngs2_routing`, `ngs2_userfx` and all five `ngs2_custom_safety_*` cases. - With the pre-commit `Custom.cpp` (bdc7af81b^) and the new test, the run aborts with `NGS2: multiple custom buffers require a submixer with at most one Gain module`. That matches the body. - `git merge-tree` with current `main` (52c09d567d) is clean, and `check_conventions --head` passes. **Mutants** (each one applied to `Custom.cpp`, then all 10 ngs2 tests run) | mutant | killed by | |---|---| | drop `CopyCustomBuffer` | TestCustomUserFxBuffers | | swap source/dest | TestCustomUserFxBuffers | | add instead of copy | TestCustomUserFxBuffers | | copy only half the buffer | TestCustomUserFxBuffers | | accept any module id in a multi-buffer submixer | TestCustomRackChecks L222 | | also accept UserFx2 `0x1a` there | TestCustomRackChecks L222 | | **drop the "handler in a multi-buffer submixer" throw** | **survives all 10** | | **drop the "multiple buffers outside a custom submixer" throw** | **survives all 10** | | drop `RefreshHasSamples` in `CopyCustomBuffer` | survives (looks equivalent: input mixing already set `hasSamples`, so a copy can only make it over-report) | | drop the size-mismatch throw | survives (equivalent: Render.cpp L301-302 sizes every buffer `grain * InputChannels()`) | The two guards the body depends on ("Two handler gaps still throw", and multi-buffer racks other than the submixer still throw) aren't tested yet. The rows below go at the end of `TestCustomUserFxBuffers`, reusing the file's `ProcessLegacy`/`LegacyUserFxState` and `CreateSamplerThrows`. They kill both mutants: the handler mutant fails at L615 (the handler gets called) and the rack mutant at L892. Head still passes in 0.09 s. ```diff --- a/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp +++ b/core/libs/prx/libSceNgs2.native/tests/Ngs2Custom.cpp @@ -869,7 +869,27 @@ for (int grain = 0; grain < 2; grain++) { const auto out = Render(system); for (std::uint32_t i = 0; i < Grain; i++) Require(out[i * 2] == 0.25f && out[i * 2 + 1] == 0.25f); + } + + LegacyUserFxState state{}; + Control(custom, SCE_NGS2_CUSTOM_VOICE_PARAM_USER_FX | 0, Ngs2CustomVoiceUserFxParam{{}, ProcessLegacy, reinterpret_cast<std::uintptr_t>(&state), 0, 0}); + bool threw = false; + try { + Render(system); + } catch (const std::runtime_error&) { + threw = true; } + Require(threw && state.calls == 0); + + Ngs2CustomSamplerRackOption sampler{}; + sampler.custom_rack_option.rack_option.size = sizeof(sampler); + sampler.custom_rack_option.rack_option.max_grain_samples = 512; + sampler.custom_rack_option.rack_option.max_voices = 1; + sampler.custom_rack_option.rack_option.max_matrices = 1; + sampler.custom_rack_option.rack_option.max_ports = 1; + sampler.custom_rack_option.num_buffers = 2; + sampler.max_channel_works = 1; + Require(CreateSamplerThrows<std::runtime_error>(sampler)); Require(sceNgs2RackDestroy(rack, nullptr) == SCE_NGS2_OK); Require(sceNgs2SystemDestroy(system, nullptr) == SCE_NGS2_OK); ``` The sampler row hits the new `outside a custom submixer` branch, since a 0-module custom sampler with 2 buffers passes every earlier check. If you'd rather cover the mastering rack too, the same row with `MasteringRackOption(2, 1)` and `num_buffers = 2` should reach the same branch. I didn't run that one. Source and host tests only; nothing on a console, and I didn't use PPSA33655. AI-assisted: yes
XairRrR commented 2026-11-03 09:17:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:17:02Z.

Review: APPROVED


Reviewed — approved

A multi-buffer custom submixer now accepts Gain and UserFx 0x19 modules, and a handler-less UserFx copies its source buffer over its dest buffer. The merged tree builds, the NGS2 tests the change touches pass, and the new test fails when Custom.cpp is put back to its main version.

What I ran

Head c17c71e4d1413e3b167debacd69ba9e8a827f35d, main 4f41f4c375f5abb487dbd184fbc150f31994d762, merged tree 488ac2d280588fa590cb03801cc164272712d80e. #10599 is already in main, so the diff against main covers only this PR's own two commits: Custom.cpp, tests/Ngs2Custom.cpp and the NGS2 debt file.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c17c71e4d1413e3b167debacd69ba9e8a827f35d
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "ngs2_(custom|userfx|gain|routing|customreverb)"
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "ngs2_core_(custom|gain|routing)"
# negative control
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libSceNgs2.native/src/Custom.cpp > core/libs/prx/libSceNgs2.native/src/Custom.cpp
ninja -C build -j32 -l32 ngs2_custom_tests
ctest --test-dir build --output-on-failure -R "^ngs2_custom$"
git show 488ac2d280588fa590cb03801cc164272712d80e:core/libs/prx/libSceNgs2.native/src/Custom.cpp > core/libs/prx/libSceNgs2.native/src/Custom.cpp
ninja -C build -j32 -l32 ngs2_custom_tests
ctest --test-dir build -R "^ngs2_custom$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) OK
Selected tests (script) 868 ran, 865 passed, 2 skipped as expected, 0 new failures, 0 timeouts
Known failure unwrap_self_..._destination_directory_group also fails on main; it is unrelated to this PR
ngs2_custom, ngs2_userfx, ngs2_gain, ngs2_routing, ngs2_customreverb, 5 × ngs2_custom_safety_* 10/10 passed (ngs2_custom 0.06 s)
ngs2_core_custom_safety_*, ngs2_core_gain, ngs2_core_routing 7/7 passed
Vulkan validation comparison Skipped by the script: no AGC, shader or VideoOut files changed

Negative control

I put core/libs/prx/libSceNgs2.native/src/Custom.cpp back to its main version and kept the new test. After the rebuild, ngs2_custom failed with Subprocess aborted. That matches the old multiple custom buffers require a submixer with at most one Gain module throw that rooklz reported. I then restored the merged file and rebuilt: ngs2_custom passed again, and git status --porcelain was empty.

Findings

Blocking

None.

Non-blocking

  • The multi-buffer handler gap shows up at render, not when the handler is set. In a multi-buffer submixer, SetCustomUserFxParam accepts a handler without complaint. The throw comes on the next render, in core/libs/prx/libSceNgs2.native/src/Custom.cpp:465, inside Ngs2ProcessUserFx. So the failure is reported away from the call that caused it, possibly on the render thread. Throwing in SetCustomUserFxParam when voice.customBuffers is not empty and the handler is not null would point at the call that hits the gap. The present behaviour is still correct and still throws, so this is optional.
  • The two new throw paths have no tests. These are the handler throw (Custom.cpp:465) and multiple custom buffers outside a custom submixer (Custom.cpp:96). rooklz already showed with mutants that no test fails when either is removed. The author declined, citing the request not to pin unimplemented behaviour. I have no new evidence; I mention it only for completeness.

Other checks

  • CopyCustomBuffer is a no-op for single-buffer racks. Creation (Custom.cpp:89-91) rejects buffer ids ≥ num_buffers, so source and dest are always 0 there, and single-buffer UserFx/Gain behaviour is unchanged.
  • The size check in CopyCustomBuffer cannot fire in practice: Render.cpp:405-406 sizes every buffer grain * InputChannels(). This agrees with rooklz's equivalent-mutant finding.
  • Calling RefreshHasSamples after the copy and after the handler is consistent with ProcessGain. It now counts every custom buffer, where the old handler path looked only at samples.
  • The debt entry still records the open items: the handler's channel count, the meaning of extra buffer 0, voice-control reordering and the invalid port-buffer errors. Its new wording replaces the old "UserFx extra-buffer selection" and "default custom module order" unknowns.
  • Checklist lines are present. "Depends on: #10599" is now satisfied, because #10599 is in main.

Not verified

  • The cited 12.70 reading (items 4, 13 and 16): I had no network access, so I could not check that the copy semantics and list order match it.
  • Console behaviour, and the PPSA33655 run, which the description attributes to JJenkx.
  • Windows/MinGW builds.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749606611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12673#pullrequestreview-5749606611). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T09:17:02Z. **Review:** APPROVED --- # Reviewed — approved A multi-buffer custom submixer now accepts Gain and UserFx `0x19` modules, and a handler-less UserFx copies its source buffer over its dest buffer. The merged tree builds, the NGS2 tests the change touches pass, and the new test fails when `Custom.cpp` is put back to its `main` version. ## What I ran Head `c17c71e4d1413e3b167debacd69ba9e8a827f35d`, `main` `4f41f4c375f5abb487dbd184fbc150f31994d762`, merged tree `488ac2d280588fa590cb03801cc164272712d80e`. #10599 is already in `main`, so the diff against `main` covers only this PR's own two commits: `Custom.cpp`, `tests/Ngs2Custom.cpp` and the NGS2 debt file. ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...c17c71e4d1413e3b167debacd69ba9e8a827f35d python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "ngs2_(custom|userfx|gain|routing|customreverb)" ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "ngs2_core_(custom|gain|routing)" # negative control git show 4f41f4c375f5abb487dbd184fbc150f31994d762:core/libs/prx/libSceNgs2.native/src/Custom.cpp > core/libs/prx/libSceNgs2.native/src/Custom.cpp ninja -C build -j32 -l32 ngs2_custom_tests ctest --test-dir build --output-on-failure -R "^ngs2_custom$" git show 488ac2d280588fa590cb03801cc164272712d80e:core/libs/prx/libSceNgs2.native/src/Custom.cpp > core/libs/prx/libSceNgs2.native/src/Custom.cpp ninja -C build -j32 -l32 ngs2_custom_tests ctest --test-dir build -R "^ngs2_custom$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / `libs` (script) | OK | | Selected tests (script) | 868 ran, 865 passed, 2 skipped as expected, 0 new failures, 0 timeouts | | Known failure | `unwrap_self_..._destination_directory_group` also fails on `main`; it is unrelated to this PR | | `ngs2_custom`, `ngs2_userfx`, `ngs2_gain`, `ngs2_routing`, `ngs2_customreverb`, 5 × `ngs2_custom_safety_*` | 10/10 passed (`ngs2_custom` 0.06 s) | | `ngs2_core_custom_safety_*`, `ngs2_core_gain`, `ngs2_core_routing` | 7/7 passed | | Vulkan validation comparison | Skipped by the script: no AGC, shader or VideoOut files changed | ## Negative control I put `core/libs/prx/libSceNgs2.native/src/Custom.cpp` back to its `main` version and kept the new test. After the rebuild, `ngs2_custom` failed with `Subprocess aborted`. That matches the old `multiple custom buffers require a submixer with at most one Gain module` throw that rooklz reported. I then restored the merged file and rebuilt: `ngs2_custom` passed again, and `git status --porcelain` was empty. ## Findings ### Blocking None. ### Non-blocking - **The multi-buffer handler gap shows up at render, not when the handler is set.** In a multi-buffer submixer, `SetCustomUserFxParam` accepts a handler without complaint. The throw comes on the next render, in `core/libs/prx/libSceNgs2.native/src/Custom.cpp:465`, inside `Ngs2ProcessUserFx`. So the failure is reported away from the call that caused it, possibly on the render thread. Throwing in `SetCustomUserFxParam` when `voice.customBuffers` is not empty and the handler is not null would point at the call that hits the gap. The present behaviour is still correct and still throws, so this is optional. - **The two new throw paths have no tests.** These are the handler throw (`Custom.cpp:465`) and `multiple custom buffers outside a custom submixer` (`Custom.cpp:96`). rooklz already showed with mutants that no test fails when either is removed. The author declined, citing the request not to pin unimplemented behaviour. I have no new evidence; I mention it only for completeness. ### Other checks - `CopyCustomBuffer` is a no-op for single-buffer racks. Creation (`Custom.cpp:89-91`) rejects buffer ids ≥ `num_buffers`, so source and dest are always 0 there, and single-buffer UserFx/Gain behaviour is unchanged. - The size check in `CopyCustomBuffer` cannot fire in practice: `Render.cpp:405-406` sizes every buffer `grain * InputChannels()`. This agrees with rooklz's equivalent-mutant finding. - Calling `RefreshHasSamples` after the copy and after the handler is consistent with `ProcessGain`. It now counts every custom buffer, where the old handler path looked only at `samples`. - The debt entry still records the open items: the handler's channel count, the meaning of extra buffer 0, voice-control reordering and the invalid port-buffer errors. Its new wording replaces the old "UserFx extra-buffer selection" and "default custom module order" unknowns. - Checklist lines are present. "Depends on: #10599" is now satisfied, because #10599 is in `main`. ## Not verified - The cited 12.70 reading (items 4, 13 and 16): I had no network access, so I could not check that the copy semantics and list order match it. - Console behaviour, and the PPSA33655 run, which the description attributes to JJenkx. - Windows/MinGW builds. <!-- anyps5-bots job=3245 head=c17c71e4d1413e3b167debacd69ba9e8a827f35d -->
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!12673
No description provided.