DSP: the reverb convolver passes the host checks (rebased #240) #2481

Open
kais7654 wants to merge 3 commits from upstream-pr/2483 into main
kais7654 commented 2026-11-25 14:37:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T14:37:30Z.


The reverb convolver of #240 (@Quat3rnion, commit author preserved),
rebased onto main 940d32f and unblocked on the checks the CI enforces.

#240's head fails the check job on clippy -D warnings: five warnings in
the new code (two needless_range_loop in dsp_convolve.rs, dead_code on
reset and encode_ir — their only callers are the tests, so both are
cfg(test) now — an undocumented unsafe block in dsp.rs, and a doubled
f32 cast). All five are fixed in the second commit; the convolution
itself is untouched.

Commits:

  1. c3b3c64 — #240's change as it is (FFT convolver decodes the console's
    partitioned frequency-domain IR; FFT/IFFT streams still silence);
  2. the clippy fixes;
  3. #1943's descriptor-heap test adaptation (cherry-picked), because
    dynamic_slots_are_held_until_released and
    lists_share_a_table_and_copies_keep_their_views fail on a heap-capped
    host otherwise.

Verified on an RTX 5070 Laptop GPU, Windows 11, driver 616.87:
cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings passes, cargo test -p victory-hle is 150 passed / 0
failed (the seven convolver tests and the two
XDspActivate/XDspSubmitCommand end-to-end ones included), and the
victory-gpu suite passes on a host that caps its heaps. Not verified:
audio against the real title (no retail package here) — the same limits
#240 declared.

AI-assisted (Mistral Vibe).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5493444192 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T14:37:30Z. --- The reverb convolver of #240 (@Quat3rnion, commit author preserved), rebased onto main 940d32f and unblocked on the checks the CI enforces. #240's head fails the check job on clippy -D warnings: five warnings in the new code (two needless_range_loop in dsp_convolve.rs, dead_code on `reset` and `encode_ir` — their only callers are the tests, so both are cfg(test) now — an undocumented unsafe block in dsp.rs, and a doubled f32 cast). All five are fixed in the second commit; the convolution itself is untouched. Commits: 1. c3b3c64 — #240's change as it is (FFT convolver decodes the console's partitioned frequency-domain IR; FFT/IFFT streams still silence); 2. the clippy fixes; 3. #1943's descriptor-heap test adaptation (cherry-picked), because dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views fail on a heap-capped host otherwise. Verified on an RTX 5070 Laptop GPU, Windows 11, driver 616.87: `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` passes, `cargo test -p victory-hle` is 150 passed / 0 failed (the seven convolver tests and the two XDspActivate/XDspSubmitCommand end-to-end ones included), and the victory-gpu suite passes on a host that caps its heaps. Not verified: audio against the real title (no retail package here) — the same limits #240 declared. AI-assisted (Mistral Vibe).
catminou4 commented 2026-11-25 14:57:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:57:43Z.

Review: COMMENTED


DSP reverb convolver passes host checks (+557, gpu+hle, rebased #2400s). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Audio path; needs hardware validation.

<!-- greyfinch-sync:Marvisak/VIctory:review:6059998383 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483#pullrequestreview-6059998383). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T14:57:43Z. **Review:** COMMENTED --- DSP reverb convolver passes host checks (+557, gpu+hle, rebased #2400s). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Audio path; needs hardware validation.
oni-swr commented 2026-11-25 15:04:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T14:58:46Z.


Independent Windows verification (CPU + software WARP only; no hardware GPU)

  • PR head: 22bfa498d3ada1211a5c45804dc42e748ce4c010; origin/main: 940d32f69b22265690a0b5a15d6ded572ba33baf (merge base = origin/main; git merge-tree clean)
  • Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1
  • WARP: VICTORY_D3D12_WARP=1 with --features diagnostics (that is what makes victory-gpu pick warp_adapter(), i.e. Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id).

Results:

  • cargo test -p victory-hle --lib --locked -- --test-threads=1: 150 passed, 0 failed, 0 ignored. This includes the new dsp::tests::convolution_through_the_api_returns_wet_audio, convolution_stream_as_the_title_drives_it, and all 6 dsp_convolve::tests.
  • cargo test -p victory-gpu --lib --locked --features diagnostics -- --test-threads=1 (WARP): 146 passed, 0 failed, 2 ignored. descriptor::host::tests::dynamic_slots_are_held_until_released passes on WARP. Note WARP does not cap its heap, so the new "device caps its heap" skip branches in the touched host.rs/memory.rs tests are not exercised here (they only matter on NVIDIA-style capped hosts).
  • cargo clippy -p victory-hle -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: asset policy: 183 files ok.

Diff review (by inspection, not covered by a run):

  1. Possible bug with stereo IRs: XDspActivate builds the IR slice as from_raw_parts(desc.ir, desc.ir_floats), but Convolver::new requires ir.len() >= ir_floats * channels when stereo_ir (option bit 8, 2 channels). With a slice of exactly ir_floats floats that check fails, so I expect any activation with the stereo-IR option to return E_INVALIDARG. The unit tests that cover stereo call Convolver::new directly with a longer slice, so the API path is not covered. Either the slice should be ir_floats * channels long (if ir_floats is per channel) or new should treat ir_floats as the total. Please confirm which the console API means.
  2. ir_floats that is not a multiple of 2 * frames silently drops the trailing partial block (accepted by valid).
  3. The Nyquist bin is assumed dropped from the console layout (reconstructed by conjugate symmetry, Nyquist taken as zero). I cannot check the layout against anything here; the tests validate the convolver against its own encode_ir, so they prove internal consistency, not hardware fidelity.
  4. Per-call Vec allocations in process are already flagged by the PR's shortcut: comment.

Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166112687 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7166112687). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T14:58:46Z. --- **Independent Windows verification (CPU + software WARP only; no hardware GPU)** - PR head: `22bfa498d3ada1211a5c45804dc42e748ce4c010`; `origin/main`: `940d32f69b22265690a0b5a15d6ded572ba33baf` (merge base = origin/main; `git merge-tree` clean) - Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1 - WARP: `VICTORY_D3D12_WARP=1` with `--features diagnostics` (that is what makes `victory-gpu` pick `warp_adapter()`, i.e. Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id). Results: - `cargo test -p victory-hle --lib --locked -- --test-threads=1`: 150 passed, 0 failed, 0 ignored. This includes the new `dsp::tests::convolution_through_the_api_returns_wet_audio`, `convolution_stream_as_the_title_drives_it`, and all 6 `dsp_convolve::tests`. - `cargo test -p victory-gpu --lib --locked --features diagnostics -- --test-threads=1` (WARP): 146 passed, 0 failed, 2 ignored. `descriptor::host::tests::dynamic_slots_are_held_until_released` passes on WARP. Note WARP does not cap its heap, so the new "device caps its heap" skip branches in the touched `host.rs`/`memory.rs` tests are not exercised here (they only matter on NVIDIA-style capped hosts). - `cargo clippy -p victory-hle -p victory-gpu --all-targets --locked -- -D warnings`: clean. - `cargo xtask policy`: `asset policy: 183 files ok`. Diff review (by inspection, not covered by a run): 1. Possible bug with stereo IRs: `XDspActivate` builds the IR slice as `from_raw_parts(desc.ir, desc.ir_floats)`, but `Convolver::new` requires `ir.len() >= ir_floats * channels` when `stereo_ir` (option bit 8, 2 channels). With a slice of exactly `ir_floats` floats that check fails, so I expect any activation with the stereo-IR option to return `E_INVALIDARG`. The unit tests that cover stereo call `Convolver::new` directly with a longer slice, so the API path is not covered. Either the slice should be `ir_floats * channels` long (if `ir_floats` is per channel) or `new` should treat `ir_floats` as the total. Please confirm which the console API means. 2. `ir_floats` that is not a multiple of `2 * frames` silently drops the trailing partial block (accepted by `valid`). 3. The Nyquist bin is assumed dropped from the console layout (reconstructed by conjugate symmetry, Nyquist taken as zero). I cannot check the layout against anything here; the tests validate the convolver against its own `encode_ir`, so they prove internal consistency, not hardware fidelity. 4. Per-call `Vec` allocations in `process` are already flagged by the PR's `shortcut:` comment. Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.
Marvisak commented 2026-11-25 16:09:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:55:59Z.


Automated triage for the maintainers.

Proposed close: this re-packages two other open PRs, #240 (the convolver, commit c3b3c64) and #1943 (the descriptor-heap test changes), and adds only the clippy fixes on top. Those fixes are welcome, but they belong on #240 (as a suggestion there or a PR to its branch), where the review is already going on. Splitting the same change across two PRs makes it harder to review.

It also still has the problems noted on #240, which the clippy commit does not touch:

  • The impulse-response layout Convolver::new decodes (complex pairs in blocks of frames, the Nyquist bin dropped, one run per channel) has no cited evidence, while origin/main's module doc in dsp.rs says the layout is unknown. The tests use the PR's own encode_ir, so they only show that the code agrees with itself.
  • valid() now rejects a null IR and ir_floats < 2 * frames, which changes what XDspActivate returns, again without evidence.
  • Stereo IRs fail: XDspActivate builds a slice of ir_floats floats, but Convolver::new requires ir_floats * channels when the stereo-IR bit is set, so a stereo stream with that option now gets E_INVALIDARG where main accepts it.
  • Comments in dsp.rs and dsp_convolve.rs use identifiers copied from the console SDK headers. Please reword them.

CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167441785 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7167441785). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:55:59Z. --- <!-- victory-triage v1 head=22bfa498d3ada1211a5c45804dc42e748ce4c010 verdict=proposed-close at=2026-11-25T15:55:45Z --> Automated triage for the maintainers. Proposed close: this re-packages two other open PRs, #240 (the convolver, commit c3b3c64) and #1943 (the descriptor-heap test changes), and adds only the clippy fixes on top. Those fixes are welcome, but they belong on #240 (as a suggestion there or a PR to its branch), where the review is already going on. Splitting the same change across two PRs makes it harder to review. It also still has the problems noted on #240, which the clippy commit does not touch: - The impulse-response layout `Convolver::new` decodes (complex pairs in blocks of `frames`, the Nyquist bin dropped, one run per channel) has no cited evidence, while `origin/main`'s module doc in `dsp.rs` says the layout is unknown. The tests use the PR's own `encode_ir`, so they only show that the code agrees with itself. - `valid()` now rejects a null IR and `ir_floats < 2 * frames`, which changes what `XDspActivate` returns, again without evidence. - Stereo IRs fail: `XDspActivate` builds a slice of `ir_floats` floats, but `Convolver::new` requires `ir_floats * channels` when the stereo-IR bit is set, so a stereo stream with that option now gets `E_INVALIDARG` where `main` accepts it. - Comments in `dsp.rs` and `dsp_convolve.rs` use identifiers copied from the console SDK headers. Please reword them. CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
thebigredder commented 2026-11-26 18:44:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by thebigredder on 2026-11-26T18:44:25Z.


In game this convolver's output is infinite in every sample: the title's IRs end in a partition that starts with 0xfffface1 (a NaN), and its partitions are 2-block windows a block apart, so overlaps count twice. Both are measured from the title's own IRs and fixed on top of this PR's commits in #3332, with the stereo-IR / stream-slot fix from project-flamingo; phone calls, TVs and radios play there, tested in game on Windows and under Wine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7200798265 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7200798265). Originally posted by [thebigredder](https://github.com/thebigredder) on 2026-11-26T18:44:25Z. --- In game this convolver's output is infinite in every sample: the title's IRs end in a partition that starts with 0xfffface1 (a NaN), and its partitions are 2-block windows a block apart, so overlaps count twice. Both are measured from the title's own IRs and fixed on top of this PR's commits in #3332, with the stereo-IR / stream-slot fix from project-flamingo; phone calls, TVs and radios play there, tested in game on Windows and under Wine.
kilolimaVI commented 2026-11-26 21:46:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-26T21:46:15Z.


Checked this against current main (README: "Reverb is silent"), Windows 11, Ryzen 7 8845HS, toolchain 1.98.1:

  • git merge onto main 63bcca4: clean, no conflicts.
  • cargo test -p victory-hle --lib --locked -- dsp on the merge: 8 passed, 0 failed (the 6 dsp_convolve tests plus convolution_through_the_api_returns_wet_audio and convolution_stream_as_the_title_drives_it).
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings, and the same with --all-features: clean.

So it still applies and passes CI's checks for the crate as of today. Note it also carries 945d5b7 ("GPU: the descriptor-heap tests take a host that caps its heaps into account"), which is #1943's change, unrelated to reverb. It contains #240's commit, so #240 can close if this one is taken.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204042824 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7204042824). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-26T21:46:15Z. --- Checked this against current main (README: "Reverb is silent"), Windows 11, Ryzen 7 8845HS, toolchain 1.98.1: - `git merge` onto main 63bcca4: clean, no conflicts. - `cargo test -p victory-hle --lib --locked -- dsp` on the merge: 8 passed, 0 failed (the 6 `dsp_convolve` tests plus `convolution_through_the_api_returns_wet_audio` and `convolution_stream_as_the_title_drives_it`). - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`, and the same with `--all-features`: clean. So it still applies and passes CI's checks for the crate as of today. Note it also carries 945d5b7 ("GPU: the descriptor-heap tests take a host that caps its heaps into account"), which is #1943's change, unrelated to reverb. It contains #240's commit, so #240 can close if this one is taken. AI-assisted (Claude).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2483:upstream-pr/2483'
git switch 'upstream-pr/2483'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2483'
git switch 'upstream-pr/2483'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2483'
git switch 'upstream-pr/2483'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2483'
git switch 'main'
git merge --squash 'upstream-pr/2483'
git switch 'main'
git merge --ff-only 'upstream-pr/2483'
git switch 'main'
git merge 'upstream-pr/2483'
git push origin 'main'
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
Marvisak/VIctory!2481
No description provided.