d3d12_xs: the title's queue slot 18 is the frequency getter, not PC GetDesc (RT-QUEUE18) #403

Merged
Mumogg merged 9 commits from upstream-pr/403 into main 2026-11-25 00:13:58 +00:00
Mumogg commented 2026-11-24 04:44:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T04:44:00Z.


Claimed in #14 as RT-QUEUE18. Depends on: the stack up to #396 (their commits come first here; this pull request is the last commit). The change itself is in the queue proxy and its test.

What and why

This is the cause of the fault I could not explain in #391, #395 and #396.

Command-queue slot 18 is ID3D12CommandQueue::GetDesc on the PC: a struct return that writes a 16-byte D3D12_COMMAND_QUEUE_DESC through its hidden pointer. The retail title calls queue slot 18 with one pointer to 8 bytes. That is the shape of GetTimestampFrequency(UINT64*), which the console queue has at that slot: two methods are inserted at 14 and 15, so the PC slots 16 to 18 sit two later. main forwarded the call as GetDesc, which wrote a description over the title's 8 bytes and the 8 after them.

How I found it: the normalized D3D12 traces of this path and of the integration branch (#321) were the same up to that point except for one extra line here, ID3D12CommandQueue::GetDesc called right after XboxID3D12CommandQueue::GetDesc called.

The change: the title's call goes to the PC slot 16. "The title's call" is decided by the caller classifier device slots 61 and 74 use (set_console_caller), so a host caller, and every caller when no classifier is installed, keeps the PC GetDesc.

Written by me, not cherry-picked. The reading of slot 18 comes from the console queue work of old PR 2490 (Nolan Cotter), which answers an undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That work detects the queue layout at run time and does not apply to main's queue proxy; this is the one rule the boot needs. Slots 19 and 20 are left as they are: I have not seen the title call them.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on main ece4ba5b3, with #142, #219, #328 and #387 applied on top for the boot runs (they are not in this branch).

--run Traced calls Ends with
up to #396 11,950 the title writing through a null pointer after its first ExecuteCommandLists ok
+ this 11,992 the title's own int3 on another thread, after command-queue slot 32 is refused

What the fault was hiding: after the first submission the title now records on its list (Barrier, ClearRenderTargetView, Barrier), submits again, creates six samplers and five placed resources with their views, and calls queue slot 32, which is PresentX. That is the first present call on this path. It is refused as past the PC queue table, and one ID3D12GraphicsCommandList::Close fails along the way; those are the next two things to look at.

That the overrun is what broke the title is an inference from the forwarded call's shape; what is measured is that the fault is gone with this change and nothing else.

Tests under Wine: xs_proxy_mock_test passes with the new case (the guest call reaches the mock queue's slot 16 with its pointer and leaves the words around it alone; a host call, with a classifier and with none, reaches slot 18). queue_proxy_test passes on the Vulkan backend.

Not built with MSVC and not run on Windows.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466227504 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/403). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T04:44:00Z. --- Claimed in #14 as `RT-QUEUE18`. Depends on: the stack up to #396 (their commits come first here; this pull request is the last commit). The change itself is in the queue proxy and its test. ### What and why This is the cause of the fault I could not explain in #391, #395 and #396. Command-queue slot 18 is `ID3D12CommandQueue::GetDesc` on the PC: a struct return that writes a 16-byte `D3D12_COMMAND_QUEUE_DESC` through its hidden pointer. The retail title calls queue slot 18 with one pointer to 8 bytes. That is the shape of `GetTimestampFrequency(UINT64*)`, which the console queue has at that slot: two methods are inserted at 14 and 15, so the PC slots 16 to 18 sit two later. `main` forwarded the call as `GetDesc`, which wrote a description over the title's 8 bytes and the 8 after them. How I found it: the normalized D3D12 traces of this path and of the integration branch (#321) were the same up to that point except for one extra line here, `ID3D12CommandQueue::GetDesc called` right after `XboxID3D12CommandQueue::GetDesc called`. The change: the title's call goes to the PC slot 16. "The title's call" is decided by the caller classifier device slots 61 and 74 use (`set_console_caller`), so a host caller, and every caller when no classifier is installed, keeps the PC `GetDesc`. Written by me, not cherry-picked. The reading of slot 18 comes from the console queue work of old PR 2490 (Nolan Cotter), which answers an undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That work detects the queue layout at run time and does not apply to `main`'s queue proxy; this is the one rule the boot needs. Slots 19 and 20 are left as they are: I have not seen the title call them. ### Measured Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on `main` `ece4ba5b3`, with #142, #219, #328 and #387 applied on top for the boot runs (they are not in this branch). | `--run` | Traced calls | Ends with | |---|---|---| | up to #396 | 11,950 | the title writing through a null pointer after its first `ExecuteCommandLists ok` | | + this | 11,992 | the title's own `int3` on another thread, after command-queue slot 32 is refused | What the fault was hiding: after the first submission the title now records on its list (`Barrier`, `ClearRenderTargetView`, `Barrier`), submits again, creates six samplers and five placed resources with their views, and calls **queue slot 32, which is `PresentX`**. That is the first present call on this path. It is refused as past the PC queue table, and one `ID3D12GraphicsCommandList::Close` fails along the way; those are the next two things to look at. That the overrun is what broke the title is an inference from the forwarded call's shape; what is measured is that the fault is gone with this change and nothing else. Tests under Wine: `xs_proxy_mock_test` passes with the new case (the guest call reaches the mock queue's slot 16 with its pointer and leaves the words around it alone; a host call, with a classifier and with none, reaches slot 18). `queue_proxy_test` passes on the Vulkan backend. Not built with MSVC and not run on Windows. AI-assisted (Claude Code); built and run on the machine above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
aslan2142 commented 2026-11-25 00:14:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T00:14:00Z.


Merged. Mumogg is still away and this is the next rung on main's boot path, so I brought the branch up to date as with the rungs before it: one merge commit on top of 862890c89 (fb2afdccc), merging main with #391, #395 and #396 in it. Mumogg's commit is untouched and nothing was force-pushed. There were no conflicts.

What it does: queue slot 18 is the frequency getter for the title's calls. A caller in a guest-mapped image goes to the PC slot 16 (GetTimestampFrequency(UINT64*)); a host caller, and every caller when no classifier is installed, keeps the PC GetDesc. The check is is_console_caller, as for device slots 61 and 74. This stops the PC GetDesc writing 16 bytes over the title's 8-byte argument, which by Mumogg's reading is what broke the title after its first submission.

How it is known: the mapping agrees with the console queue table Kokonotcu posted in #14 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122307218): 16 Signal, 17 Wait, 18 frequency, 19 GetClockCalibration, 20 GetDesc. What this PR measures itself is that the fault goes away; that the overrun was its cause is an inference, as the PR says.

Holds and requests: none on this PR.

Tests (clang-cl with the xwin SDK; Wine, headless; llvmpipe and an RDNA2 iGPU):

  • Full Windows suite under Wine, the branch against main with #396: no test changed state on either device (259 pass and 15 fail on llvmpipe, 255 and 21 on the iGPU, on both sides).
  • queue_proxy, xs_proxy_mock with its six variants and device_proxy pass on both devices.
  • check_no_game_data.py on the two changed files is clean. The Linux portable subset does not build these files.
  • Not run here: MSVC, native Windows, and the game itself. Mumogg's run goes from 11,950 to 11,992 traced calls with this, and then stops because queue slot 32 (PresentX) is refused.

For later:

  • Slots 19 (GetClockCalibration) and 20 (GetDesc) of the same table, and refusing 14 and 15, which are unmeasured. Slots 16 and 17 are #430.
  • A PC-form caller from a guest-mapped image would get the frequency too. Keying on the queue (only queues made through device slot 48) would be tighter than keying on the caller.
  • There is no row for queue slot 18 in docs/d3d12_vulkan.md.

Next: #414 (PresentX). It needs more than a merge: main already routes PresentX (default slot 30, moved with LEONIDA_XS_PRESENT_X_SLOT) and has attach_xbox_presentation, which nothing calls yet, while #414 hard-codes slot 32 with a presentation path of its own. What main lacks and #414 brings is the token source shared between device slot 80 and the pacer, and the code that creates the presenter.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7148290823 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/403#issuecomment-7148290823). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T00:14:00Z. --- Merged. Mumogg is still away and this is the next rung on `main`'s boot path, so I brought the branch up to date as with the rungs before it: one merge commit on top of `862890c89` (`fb2afdccc`), merging `main` with #391, #395 and #396 in it. Mumogg's commit is untouched and nothing was force-pushed. There were no conflicts. **What it does:** queue slot 18 is the frequency getter for the title's calls. A caller in a guest-mapped image goes to the PC slot 16 (`GetTimestampFrequency(UINT64*)`); a host caller, and every caller when no classifier is installed, keeps the PC `GetDesc`. The check is `is_console_caller`, as for device slots 61 and 74. This stops the PC `GetDesc` writing 16 bytes over the title's 8-byte argument, which by Mumogg's reading is what broke the title after its first submission. **How it is known:** the mapping agrees with the console queue table Kokonotcu posted in #14 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122307218): 16 `Signal`, 17 `Wait`, 18 frequency, 19 `GetClockCalibration`, 20 `GetDesc`. What this PR measures itself is that the fault goes away; that the overrun was its cause is an inference, as the PR says. **Holds and requests:** none on this PR. **Tests** (clang-cl with the xwin SDK; Wine, headless; llvmpipe and an RDNA2 iGPU): - Full Windows suite under Wine, the branch against `main` with #396: no test changed state on either device (259 pass and 15 fail on llvmpipe, 255 and 21 on the iGPU, on both sides). - `queue_proxy`, `xs_proxy_mock` with its six variants and `device_proxy` pass on both devices. - `check_no_game_data.py` on the two changed files is clean. The Linux portable subset does not build these files. - Not run here: MSVC, native Windows, and the game itself. Mumogg's run goes from 11,950 to 11,992 traced calls with this, and then stops because queue slot 32 (`PresentX`) is refused. **For later:** - Slots 19 (`GetClockCalibration`) and 20 (`GetDesc`) of the same table, and refusing 14 and 15, which are unmeasured. Slots 16 and 17 are #430. - A PC-form caller from a guest-mapped image would get the frequency too. Keying on the queue (only queues made through device slot 48) would be tighter than keying on the caller. - There is no row for queue slot 18 in `docs/d3d12_vulkan.md`. **Next:** #414 (`PresentX`). It needs more than a merge: `main` already routes `PresentX` (default slot 30, moved with `LEONIDA_XS_PRESENT_X_SLOT`) and has `attach_xbox_presentation`, which nothing calls yet, while #414 hard-codes slot 32 with a presentation path of its own. What `main` lacks and #414 brings is the token source shared between device slot 80 and the pacer, and the code that creates the presenter. AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!403
No description provided.