fix(ngs2): stop stale rendering after waveform callbacks #6029
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6029"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T19:38:47Z.
What
A PCM block-end/repeat callback can replace a waveform through
sceNgs2VoiceControl, but the renderer ignoresNgs2FinishBlock's revision result and keeps consuming the replacement with the old pitch step. A one-frame block at pitch 2 consumes 16 samples in the current grain after a callback RESET, instead of leaving the replacement untouched for the next grain.Callback SETUP can also change a mono voice into an eight-channel voice after its grain buffer was allocated for mono. Continuing with the new channel count writes past that buffer; filtering/mixing also need a valid channel layout after the callback.
Honor block completion's revision/state result and stop PCM consumption when the waveform revision changes, matching the existing ATRAC9 renderer. Preserve the already-rendered prefix for a same-channel RESET. If the channel count changes, replace the invalidated grain with a zeroed buffer of the new layout before filters or effects can use it. Ordinary queue refills continue within the current grain, and pause/refill remains resumable.
Tested
I tested on Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs), Release/Ninja, bundled dependencies and
BUILD_TESTING=ON.fd6c5ad9c: the new public-API RESET regression fails withPCM callback reset consumed 16 samples before the next grain, expected 1(0.23 s). The failure is a decoded-count assertion; I did not run an ASan build or claim a measured retail crash.After rebase onto main
9f03c4fe0, the full default Windows build passed and all 10 NGS2 tests passed again (0.73 s). Conventions, the complete PR description,git diff --check, and the repository overlap checker passed on commit18114a241. I refreshed the full open-PR inventory immediately before publication; the five shared PR heads are unchanged and none implements this fix.No title replay, console callback timing measurement or Linux run was performed. No title-specific behavior, exports, dependencies or cache budgets are added.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in technical debt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-15T00:41:48Z.
Tested on Linux x86-64 (Release build), with
18114a241merged into mainab9a47684:ngs2_core_renderandngs2_renderpass.libSceNgs2.native/src/Render.cpp: both abort withPCM callback reset consumed 16 samples before the next grain, expected 1/NGS2 check failed at line 335.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:13:39Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceNgs2.native/src/Render.cppcore/libs/prx/libSceNgs2.native/src/Render.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T21:16:46Z.
Checked the
Ngs2FinishBlockresult handling against the ATRAC9 path, the channel-change grain reset, and the three new tests. The ngs2 tests pass (10/10) andngs2_renderfails withRender.cppreverted. Also confirmed on Linux by @coltken95; merging.