HLE: XApu writes decoded audio to an unaligned output buffer as bytes (fixes #839) #1072
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!1072
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1072/head"
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?
@acleofe on GitHub · 2026-11-24 15:28 UTC · original
fix/xapu-unaligned-output→main· +47 −2 · 1 files · 1 commits · closed without mergingWhat
processbuilds the decoded frames (interleaved, or deinterleaved for stereo) in a buffer of its own and copies them to the title's output buffer as bytes, instead of making an&mut [f32]over the title's pointer.Why
The output pointer comes from the title and need not be 4-byte aligned.
slice::from_raw_parts_muton an unaligned*mut f32is undefined behaviour; with debug assertions (dev builds, tests) it aborts the process. On x86-64 release builds the unaligned stores happened to work.Test
decodes_into_an_unaligned_buffer: a 20 ms stereo Opus packet decoded into buffers at byte offsets 1, 2 and 3 gives the same bytes as at offset 0, interleaved and deinterleaved. Before this change it aborts: "slice::from_raw_parts_mut requires the pointer to be aligned".cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsandcargo test --workspace --lockedpass.🤖 Generated with Claude Code
@ThomasHFWright on GitHub · 2026-11-24 15:50 UTC · original
Independent Linux/Wine validation of
5075e1ec8b65e6fe8863f7cb8772c6634ecaffe4on baseffe310e: The newmodules::apu::tests::decodes_into_an_unaligned_bufferpasses under Wine: byte offsets 1, 2 and 3 match the aligned decode, with both interleaved and deinterleaved stereo output. This is synthetic Opus decoding into memory; no sound playback or game data.Full workspace unit/integration suite, all features, all 14 generated Windows MSVC test executables: 342 passed, 5 failed, 6 ignored. Matched baseline: 341 passed, 5 failed, 6 ignored. The five failures are unchanged: empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git.
Both Windows-target workspace Clippy configurations (all targets, with and without all features,
-D warnings) pass. Native Linux xtask: 4 passed; asset policy passes.Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton
30b0eb9bc12dc9f, natived3dcompiler_47supplied for GPU fixtures; identical runtime DLLs to baseline. Offline and offscreen. No gameplay, native Windows/WARP, or Wine doctests. Aggregate counts include existing early-return tests without optional console compilers/DXIL validator; the new regression executed. AI-assisted testing with Codex.@Zipettte on GitHub · 2026-11-24 16:29 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
5075e1e:cargo test -p victory-hlepasses, 96 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Pull request closed