Keep XMA input valid when looping back to the start of a buffer #2714
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!2714
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2714"
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:39 UTC · original
VlREX:fix/xma-loop-buffer-start→main· +16 −6 · 1 files · 1 commits · openA zero read position selects the first frame in the input buffer. When a loop requested that position, the decoder previously cleared the valid-input bit as though there were no next frame. Preserve the optional next position until the context update so a real offset of zero survives. The synthetic two-packet regression failed before the change and verifies the first frame is decoded again, with the requested subframe skip, and normal playback continues when the loop count runs out. All nine audio module tests passed in an isolated Windows GNU run. No in-game verification.
@kotekompotek on GitHub · 2026-11-25 18:51 UTC · original
Elegant fix - Option is exactly the right type for 'no next frame' vs 'next at bit 0'. The loop path assigning Some(field) preserves a genuine zero loop start, and the regression verifies both halves: input stays valid through the wrap and invalidates normally when loops run out.
@fuzeofficlal on GitHub · 2026-11-25 19:38 UTC · original
Independent Windows 11 verification and review of
69d5708(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, includinga_loop_to_the_start_of_the_buffer_keeps_the_input_valid), plusfidelityfx(1) andno_dll_planting(1) clean.git merge-treeacross the entire 5-PR stack #2694 + #2708 + #2709 + #2710 + #2714.Review Notes
nextfrom a0sentinel toOption<usize>keepsvalid == 1whenloop_start == 0while still clearing the valid bit on true end-of-stream (frame.next == None), and pairs directly with #2708 when the nextdecode()seesat < 32. Clean and ready to merge.@oni-swr on GitHub · 2026-11-25 19:41 UTC · original
Independent WARP/CPU verification
Head:
69d5708107565d3740bcdb408d8e41d397042544Base:
origin/main13f91caee25f2fdf2c062be5f7a27f058e51cbcaStatus: open, non-draft; clean merge tree; no
oni-swrcomment on this head.Environment: Windows x64, WARP selected (
VICTORY_WARP=1,VICTORY_D3D12_WARP=1),dxil.dll1.8.2502.11 from Windows SDK 10.0.26100.0; rustc 1.98.1.Commands (each with
CARGO_TARGET_DIR=D:\victory-warp-2690-targetand the WARP variables above):cargo test --locked -p victory-hlecargo test --locked -p victory-hle a_loop_to_the_start_of_the_buffer_keeps_the_input_validcargo clippy --locked -p victory-hle --all-targets -- -D warningsResults: baseline 148 passed, 0 failed (146 unit + 2 integration); PR 149 passed, 0 failed (147 unit + 2 integration). Targeted regression 1/1 passed. Clippy passed.
Negative control: restored the old
0 == no next frameinvalidation; the new loop-to-zero test failed (exit 101), as expected. No implementation bug found.Not tested: physical GPU, retail title, release build. AI-assisted: Codex (gpt-6-luna).
@Marvisak on GitHub · 2026-11-25 23:17 UTC · original
Automated triage for the maintainers.
In
crates/victory-hle/src/modules/audio.rsdecode, the next read position becomes anOption<usize>, so a loop whose start field (context dword 3) is 0 no longer clears the input's valid bit as if the stream had ended. I checked this againstmain:decodealready treats a read position below 32 as "the first frame of the buffer", so 0 is a real position there and the old0 == no next framesentinel conflicted with that. The test is now parameterised over loop starts 32 and 0, and the 0 case asserts that the valid bit stays set. CI (check) passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
@DenRakEiw on GitHub · 2026-11-26 00:49 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory-hle audio::: 9/9 passed (includinga_loop_to_the_start_of_the_buffer_keeps_the_input_valid).cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 192 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@futurepro62 on GitHub · 2026-11-26 12:17 UTC · original
NVIDIA full-suite run, to go with the reports above by DenRakEiw, fuzeofficlal, oni-swr, since none of them names a GPU run. Tested exact head
69d5708(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.a_loop_to_the_start_of_the_buffer_keeps_the_input_valid.--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
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.