fix(d3d12): support Xbox command list interface creation #699

Closed
github-bot wants to merge 11 commits from gh-pr/699/head into gh-pr/699/base
Owner

@⁠lucyr03 on GitHub · 2026-11-24 12:19 UTC · original
lucy → main · +0 −0 · 0 files · 0 commits · closed without merging

Request the standard PC ID3D12GraphicsCommandList interface internally and expose the Xbox-specific command list IID through the compatibility proxy.

Fixes the initial CreateCommandListX failure during GTA VI graphics initialization.

Verified by launching the game: D3D12 call #13 now succeeds and initialization progresses through call #1639, including command allocator, command list, and resource creation.

Claimed in the coordination issue as:

Depends on:

Fixes:

What and why

Tested

GPUs tested:

AI-assisted:

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
**@⁠lucyr03** on GitHub · 2026-11-24 12:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/699) `lucy` → `main` · +0 −0 · 0 files · 0 commits · closed without merging Request the standard PC ID3D12GraphicsCommandList interface internally and expose the Xbox-specific command list IID through the compatibility proxy. Fixes the initial CreateCommandListX failure during GTA VI graphics initialization. Verified by launching the game: D3D12 call #13 now succeeds and initialization progresses through call #1639, including command allocator, command list, and resource creation. Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> Fixes: <!-- #N for each issue this closes (GitHub closes it on merge); delete the line if it closes none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> GPUs tested: <!-- vendor, model, driver and OS of each GPU the GPU tests ran on, or n/a --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### Checklist - [ ] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [ ] One topic; follow-up work goes in a new pull request. - [ ] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
- Add portable C++20 XMA2 packet parser and WMA Pro frame decoder
  (runtime/src/xma2_decoder.{h,cpp}, following FFmpeg wmaprodec.c /
  wmaprodata.h LGPL-2.1-or-later under Leonida's GPL-3.0-or-later)
  with cross-platform xma2_decoder_test.
- Implement IAcpHal command/message queue protocol (REGISTER_MESSAGES,
  UNREGISTER_MESSAGES, LOAD_FLOWGRAPH, COMMAND_COMPLETED, DISCONNECTED,
  queue-full dropped counters, and APU notification word writes) in
  runtime/shims/acphal.cpp.
- Wire a lazily-started, cleanly-joined background XMA2 decoder thread
  pumping enabled SHAPE_XMA_CONTEXT output rings in APU memory.
stop_worker set a shared stopping_ flag, moved the thread out and joined it
after releasing worker_mutex_. A wake in that window reset stopping_ and
started a second worker, so the old one kept running and the join could hang.
Each worker is now a std::jthread with its own stop_token (waits use
condition_variable_any with the token), so a stop only reaches its own thread.

acphal_test races 20000 context alloc/release rounds against ENABLE_XMA on a
second thread (the unfixed code hung there intermittently).

AI-assisted. Tested: acphal_test 115 checks, 0 failures, repeated runs
(clang 23 / mingw x64).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the hand-written C++ XMA2/WMA Pro decoder with the Rust decoder
already on main. runtime/CMakeLists.txt builds it at configure time when
cargo is on PATH and links it into gta6rt and acphal_test
(LEONIDA_HAVE_XMA2_DECODER); without cargo, if that build fails, or with
the cl.exe fallback, XMA voices output silence for each packet's frame
count.

The ring engine decodes whole 2048-byte packets: the read offset and the
loop points are used per packet, so a loop plays its end packet in full
and restarts with a fresh decoder at the packet holding the loop start.
The C ABI gains leonida_xma2_decoder_create_hardware (no first-frame drop,
no 64-sample start skip), since the context carries its own skip.

Tested: acphal_test 129 checks (silence) and 125 checks (Rust decoder,
gnullvm build), 0 failures, 3 runs each, clang 23 / mingw x64; cargo fmt
and cargo test (gnullvm); pytest build/docs suites 204 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
acphal: ACP message queue and background XMA ring decoding with the Rust XMA2 decoder (RT-ACPHAL-XMA2)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:16:59 +00:00
github-bot closed this pull request 2026-11-26 09:16:59 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 12:29 UTC · original · approved these changes

Reviewed and verified Xbox command list interface creation support. Recognizing console graphics command list IID {c3827890-4024-474c-98cf-645b51dc4874}\ in \is_list_iid()\ and \list_query_interface()\ while requesting standard \ID3D12GraphicsCommandList\ from the host device in \proxy_create_command_list_x()\ resolves host IID rejection during console command list instantiation. LGTM, approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 12:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/699#pullrequestreview-6039206793) · **approved these changes** Reviewed and verified Xbox command list interface creation support. Recognizing console graphics command list IID \{c3827890-4024-474c-98cf-645b51dc4874}\ in \is_list_iid()\ and \list_query_interface()\ while requesting standard \ID3D12GraphicsCommandList\ from the host device in \proxy_create_command_list_x()\ resolves host IID rejection during console command list instantiation. LGTM, approved.
Author
Owner

@⁠lixonik on GitHub · 2026-11-24 13:18 UTC · original · reviewed

Independent Windows mock tests on a full checkout at b6956b1. I checked that the entire runtime/ tree is unchanged at the current head 2e46a75.

  • Stock xs_proxy_mock_test fails at the existing assertion that the ordinary PC IID pointer reaches the backend unchanged. To check the difference beyond pointer identity, I also passed a normal ID3D12GraphicsCommandList6 IID to slot 73 on a GCL6-capable mock and compared IID values. The control shim at 21625bca forwards GCL6, while this PR sends the base ID3D12GraphicsCommandList IID. The value assertion fails on the PR.
  • The Xbox-IID case with a base-only mock succeeds here. The equivalent case on #641 at 2f41bb1 fails because #641 requests GCL6. This is a useful compatibility distinction between the overlapping changes.

Could the base-IID substitution be limited to the Xbox IID, leaving ordinary PC IIDs untouched? That would preserve the first behavior while keeping the base-only Xbox case. Synthetic COM objects only, no GPU or game run. AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-24 13:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/699#pullrequestreview-6039887071) · **reviewed** Independent Windows mock tests on a full checkout at `b6956b1`. I checked that the entire `runtime/` tree is unchanged at the current head `2e46a75`. - Stock `xs_proxy_mock_test` fails at the existing assertion that the ordinary PC IID pointer reaches the backend unchanged. To check the difference beyond pointer identity, I also passed a normal `ID3D12GraphicsCommandList6` IID to slot 73 on a GCL6-capable mock and compared IID values. The control shim at `21625bca` forwards GCL6, while this PR sends the base `ID3D12GraphicsCommandList` IID. The value assertion fails on the PR. - The Xbox-IID case with a base-only mock succeeds here. The equivalent case on #641 at `2f41bb1` fails because #641 requests GCL6. This is a useful compatibility distinction between the overlapping changes. Could the base-IID substitution be limited to the Xbox IID, leaving ordinary PC IIDs untouched? That would preserve the first behavior while keeping the base-only Xbox case. Synthetic COM objects only, no GPU or game run. AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.