Skip to content

[upstream #1149] XAudio2: an XMA voice reports no bytes required, as the docs say - #13

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1149
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1149

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

XMA source voices play through a Windows PCM16 voice. XCL's callback wrapper passed that voice's OnVoiceProcessingPassStart BytesRequired (the PCM16 it needs) on to the title. Microsoft's documentation of IXAudio2VoiceCallback::OnVoiceProcessingPassStart says that for xWMA and XMA data BytesRequired is always zero. A title that streams just in time from this value sees its XMA voice as starving and submits more data than it needs.

The voice state now records whether the title submits XMA, and only then passes 0 on. Opus voices, which the documentation does not cover, keep the count as before.

What is in it

  • crates/xcl/src/hle/xaudio2.rs: DecodedVoiceState remembers whether the voice is XMA; the pass-start wrapper reports 0 for it. Test decoded_voice_reports_no_bytes_required_to_the_title (XMA reports 0, an Opus voice still reports the PCM count).

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on 41c4305: 742 passed, 0 failed, 41 ignored; no SKIPPED GPU tests
  • the new test fails without the change and passes with it; the first suite run had one failure in placed_title_textures_share_vram_and_preserve_pixels (the cubemap reuse flake of Tests: placed_title_textures_share_vram_and_preserve_pixels fails now and then at its cubemap reuse check (main 9ce2070) xcl-dev/xcl#718, two other tests then failed on its poisoned lock); cargo test -p xcl --lib hle::d3d12x:: then passed 3 times in a row on this head, and the whole suite again (the counts above)

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1541 (PresentX 1541)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19650 MB

this PR:

xcl-smoke v1
commit: 41c43053b10628515a0f528263b7fbf42e3190c7
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1563 (PresentX 1563)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19666 MB

Not tested

  • A title that streams XMA from BytesRequired: the smoke title does not show a difference in its run.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code


Mirror of xcl-dev#1149 (auto-synced, do not edit).

XMA source voices play through a Windows PCM16 voice, and the callback
wrapper passed that voice's OnVoiceProcessingPassStart BytesRequired (the
PCM16 it needs) on to the title. Microsoft's documentation: "For xWMA and
XMA data BytesRequired will always be zero". A title that streams just in
time from this value would see its XMA voice as starving and submit more
than it needs.

The voice state now records whether the title submits XMA, and only then
is 0 passed on. Opus voices, which the documentation does not cover, keep
the count as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#1149 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1149 branch November 25, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants