Avoid publishing a silent XMA output block after a whole-frame skip #2709
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2709
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2709"
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?
@VlREX on GitHub · 2026-11-25 18:35 UTC · original
VlREX:fix/xma-empty-output→main· +19 −3 · 1 files · 1 commits · openA successful decoder step can consume a frame while dropping every sample due to the configured subframe skip. The ring writer previously padded an empty queue with 128 zero samples and advanced the write cursor. Yield to the next decoder pass when that step leaves the queue empty. This also avoids spinning on looping streams with no output. The synthetic mono ring test produced 2944 samples instead of 2816 before the fix. All nine audio module tests passed in an isolated Windows GNU run with the real XMA decoder. No game assets were used.
@kotekompotek on GitHub · 2026-11-25 18:50 UTC · original
Correct - a fully-skipped frame advancing the decoder without samples should not publish a 128-sample silent block. The empty-queue re-check keeps the ring writable for the next pass, and the loop is still bounded since decode() returns false when input exhausts.
@oni-swr on GitHub · 2026-11-25 18:54 UTC · original
Independent WARP/CPU verification
PR head:
e52a80d34c8b1b2a4562899811e266e75c8f7c5fEnvironment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, WARP only (
VICTORY_WARP=1+VICTORY_D3D12_WARP=1),dxil.dll1.8.2502.11 (Windows SDK 10.0.26100.0), no physical GPU touched, no game files/dumps/retail hashes.CARGO_TARGET_DIRon D:,--lockedthroughout.origin/main=13f91caee25f2fdf2c062be5f7a27f058e51cbca; merges cleanly (git merge-tree); open, non-draft, nooni-swrcomment on this head.Commands / results (
cargo test --locked -p victory-formats -p victory-hle):check_decoded_ringhelper now also runs the original test).cargo clippy --locked -p victory-formats -p victory-hle --all-targets -- -D warnings→ clean.pumphunk fails the newskipping_a_whole_xma_frame_does_not_publish_a_silent_block(assert at audio.rs:1255) and, in the same run, three other xma tests that I believe failed as a cascade (shared test lock poisoned by the first panic); I did not isolate those.Baseline note: on the very first baseline
victory-hlerun,dstorage::tests::a_page_list_filled_after_its_request_startsfailed once (assertion left==right); it passed 3/3 reruns in isolation and in a full rerun (146/146), so it looks like a flaky pre-existing test unrelated to this PR.Review: no bugs found. The
pumpchange returns whendecodemade progress but produced no samples, so the ring is not advanced with a silent block. Residual risk: if a stream keeps producing empty decodes, eachpumpcall makes at most one decode step, i.e. it relies on being called again; the test covers this with two pumps. Test strength is good (exactproducedcount adjusted by the skip).Not tested: physical hardware GPU, retail game run, release build.
AI use: Claude Code (Claude Sonnet 5.5). Claim: #1633
@fuzeofficlal on GitHub · 2026-11-25 19:38 UTC · original
Independent Windows 11 verification and review of
e52a80d(on13f91ca):Verification (
rustc 1.98.1MSVC)cargo xtask policy: 184 files ok.cargo clippy --locked -p victory-formats -p victory-hle --all-targets -- -D warnings: 0 warnings.cargo test --locked -p victory-formats: 38 passed, 0 failed, 5 ignored.cargo test --locked -p victory-hle: 147 passed, 0 failed (lib, includingskipping_a_whole_xma_frame_does_not_publish_a_silent_block), plusfidelityfx(1) andno_dll_planting(1) clean.git merge-treeacross the entire 5-PR stack #2694 + #2708 + #2709 + #2710 + #2714.Review Notes
!decode(context, voice) || voice.pcm.is_empty()inpump()prevents publishing a zero-filled 128-sample block when a whole-frame skip emptiesvoice.pcm(safe becauseDecoder::decodeemits512 * channelsandflushemits256 * channels, both multiples ofSAMPLES_PER_BLOCK = 128). Clean and ready to merge.@Marvisak on GitHub · 2026-11-25 22:22 UTC · original
Automated triage for the maintainers.
Merge candidate (recommend a look). In
pump(crates/victory-hle/src/modules/audio.rs), a decode step that succeeds without queuing samples (a frame dropped entirely by the configured subframe skip, or an input switch) used to fall through and publish a block of 128 zero samples, advancing the title's write cursor. Nowpumpreturns and leaves the ring writable. I checked that this cannot stall: the decoder thread runspumpat least every 2 ms (park_timeoutinwake_decoder), anddecodereturns false once input is exhausted. The cost is one decode step per pass while frames are being skipped. The test reuses the existing ring test with a four-subframe skip and checks the exact produced count, which fails on main.CI:
checkpassing on this head. Merges cleanly with #2708, #2710 and #2714.Generated by Claude Code
@futurepro62 on GitHub · 2026-11-26 14:30 UTC · original · edited 2026-11-26 16:55 UTC
NVIDIA full-suite run, to go with the reports above by fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head
e52a80d(on its base13f91ca).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 774 passed, 0 failed, 9 ignored.frame::tests::waits_end_on_ticks_and_count_frames, a timing test. The 774/0 above is a solo rerun on the same head, where it passes. It looks timing-sensitive rather than caused by this PR: it also failed on #2371 earlier while two suites ran at once.skipping_a_whole_xma_frame_does_not_publish_a_silent_block.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@fuzeofficlal on GitHub · 2026-11-26 16:05 UTC · original · approved these changes
Reviewed
e52a80d34c8b1b2a4562899811e266e75c8f7c5f(merged cleanly onto63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 (rustc 1.98.1MSVC).Audit
crates/victory-hle/src/modules/audio.rs:509,:518: returning frompump()when(!decode(context, voice) || voice.pcm.is_empty())prevents publishing a spurious 128-sample zero block and advancing the ring write cursor whenever a decode step consumes input without queuing samples (whole-frame subframe skips, loop-truncated skips, bad frames, or input-buffer switches). Becausedecodeandflushproduce multiples ofSAMPLES_PER_BLOCK * channels, both mono and stereo remain block-aligned, and yielding on an empty decode prevents spinning insidepump()on looping zero-output streams whilewake_decoderdrives the next pass.Verification
63bcca43c6a00a758510398fa43096ce7e4f7df0+cargo run -p xtask -- policy(191 files ok)cargo clippy -p victory-hle -p victory-formats --all-targets -- -D warnings(default &--all-features)cargo test -p victory-formats --lib: 46 passed, 0 failed, 5 ignoredcargo test -p victory-hle --lib -- modules::audio::: 9/9 passed (includingskipping_a_whole_xma_frame_does_not_publish_a_silent_block).skip_subframes = 1..=4and confirmed that after the firstxma().pump()withskip_subframes = 4, the write cursor remains0, the ring remains writable (1),producedstays0, and ring memory (0x55sentinel) is untouched.@Dukestar69 on GitHub · 2026-11-26 18:12 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).voice.pcm.is_empty()afterdecodeavoids emitting a spurious silent block on a whole-frame skip (or input switch) while keeping the output ring writable for the next pump.cargo test -p victory-hle --lib modules::audio:: -- --test-threads=1: 9 passed, 0 failed (includingskipping_a_whole_xma_frame_does_not_publish_a_silent_block).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.