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

Closed
opened 2026-11-26 20:17:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/403
Author: @Mumogg
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: queue-slot18-frequency


📝 Commits (9)

  • bbae96d d3d12_xs: handle ID3D12CommandAllocator slot 9 (SetAllocatorCallbackX) on allocator proxy
  • 1bd72a8 d3d12_xs: route command queue slot 35 to ExecuteCommandLists
  • dfd62d7 docs: the recorded, never-called allocator callback of slot 9 has a row in the Xbox-only table
  • 54ed404 d3d12_xs: console list slot 139 is Reset, routed to the PC slot 10
  • 862890c d3d12_xs: the title's queue slot 18 is the frequency getter, not PC GetDesc
  • 94c9e43 Merge main into RT-QUEUE35 (#391)
  • b06d096 Merge main into RT-ALLOC9 (#395)
  • 8643373 Merge main into RT-LIST139 (#396)
  • fb2afdc Merge main into RT-QUEUE18 (#403)

📊 Changes

6 files changed (+266 additions, -33 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+1 -0)
📝 runtime/shims/d3d12_xs_device.cpp (+84 -1)
📝 runtime/shims/d3d12_xs_device.h (+18 -9)
📝 runtime/test/allocator_proxy_test.cpp (+24 -7)
📝 runtime/test/queue_proxy_test.cpp (+59 -13)
📝 runtime/test/xs_proxy_mock_test.cpp (+80 -3)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/403 **Author:** [@Mumogg](https://github.com/Mumogg) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `queue-slot18-frequency` --- ### 📝 Commits (9) - [`bbae96d`](https://github.com/ubiquitarianism/leonida/commit/bbae96de2a46e472c5e8627829d17c648b06366e) d3d12_xs: handle ID3D12CommandAllocator slot 9 (SetAllocatorCallbackX) on allocator proxy - [`1bd72a8`](https://github.com/ubiquitarianism/leonida/commit/1bd72a87ada80475d2a51f9eda359906d9962a3f) d3d12_xs: route command queue slot 35 to ExecuteCommandLists - [`dfd62d7`](https://github.com/ubiquitarianism/leonida/commit/dfd62d7e2637f181516cfe14d7cbfd0e6dc0710d) docs: the recorded, never-called allocator callback of slot 9 has a row in the Xbox-only table - [`54ed404`](https://github.com/ubiquitarianism/leonida/commit/54ed404defd035465ece0f2beeb792cf51179691) d3d12_xs: console list slot 139 is Reset, routed to the PC slot 10 - [`862890c`](https://github.com/ubiquitarianism/leonida/commit/862890c893eb19eb39eb2fd95e7786e42ff4b18c) d3d12_xs: the title's queue slot 18 is the frequency getter, not PC GetDesc - [`94c9e43`](https://github.com/ubiquitarianism/leonida/commit/94c9e43154c003acfb0b659104560c58423a7c5d) Merge main into RT-QUEUE35 (#391) - [`b06d096`](https://github.com/ubiquitarianism/leonida/commit/b06d096ad0943d5eda9bf1b17b3c3346688fc1f6) Merge main into RT-ALLOC9 (#395) - [`8643373`](https://github.com/ubiquitarianism/leonida/commit/864337351bc11a250db77c2fcdd3ba6f1d0f455f) Merge main into RT-LIST139 (#396) - [`fb2afdc`](https://github.com/ubiquitarianism/leonida/commit/fb2afdccc2314d7b5a59fac10e6d6df7f5df35ab) Merge main into RT-QUEUE18 (#403) ### 📊 Changes **6 files changed** (+266 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+1 -0) 📝 `runtime/shims/d3d12_xs_device.cpp` (+84 -1) 📝 `runtime/shims/d3d12_xs_device.h` (+18 -9) 📝 `runtime/test/allocator_proxy_test.cpp` (+24 -7) 📝 `runtime/test/queue_proxy_test.cpp` (+59 -13) 📝 `runtime/test/xs_proxy_mock_test.cpp` (+80 -3) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:56 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#454
No description provided.