[PR #414] [MERGED] d3d12_xs: the queue's slot 32 is PresentX, wired to the presentation core with a shared token source (RT-PRESENTX) #467

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

📋 Pull Request Information

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

Base: main ← Head: presentx-queue-slot32


📝 Commits (10+)

  • 522faa2 d3d12_xs: honour XMemAllocationHooks for descriptor heaps and translate CPU handles
  • f59167e d3d12_xs: device slot 25 pads a render target to whole console tiles (RT-5 stop 17)
  • 6b75cba d3d12_xs: device slot 25 gives the PC device clean resource descriptions (RT-5 stop 16)
  • 8eaccde d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums
  • e090be9 d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17)
  • 24914e7 d3d12: preserve PC descriptor validation in slot 25
  • 4056d18 ladder: kXboxTiledResourceLayout is inline const, not constexpr (clang-cl rejects 0x101 for the unfixed enum)
  • c108c53 d3d12_xs: the console render-target sizes of slots 25 and 56 are for console-form calls only
  • 0c5a146 d3d12_xs: the hook-backed descriptor address is not applied to a console-extended heap
  • c8247cd d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41)

📊 Changes

23 files changed (+2257 additions, -123 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+31 -2)
📝 runtime/CMakeLists.txt (+1 -0)
📝 runtime/shims/d3d12_com.cpp (+10 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+5 -0)
📝 runtime/shims/d3d12_xs.cpp (+17 -0)
➕ runtime/shims/d3d12_xs_alloc_size.h (+156 -0)
➕ runtime/shims/d3d12_xs_desc_clean.h (+38 -0)
📝 runtime/shims/d3d12_xs_device.cpp (+860 -52)
📝 runtime/shims/d3d12_xs_device.h (+54 -11)
📝 runtime/shims/registry.cpp (+39 -0)
📝 runtime/shims/shims.h (+13 -0)
📝 runtime/shims/xbox_present.cpp (+3 -2)
📝 runtime/shims/xbox_present.h (+2 -1)
📝 runtime/src/command_list.h (+3 -0)
📝 runtime/src/frame_pacer.h (+19 -6)
📝 runtime/src/pe_loader.cpp (+7 -0)
📝 runtime/test/allocator_proxy_test.cpp (+24 -7)
📝 runtime/test/d3d12_mesh_test.cpp (+22 -0)
📝 runtime/test/device_proxy_test.cpp (+76 -1)
📝 runtime/test/frame_pacer_test.cpp (+19 -0)

...and 3 more files

📄 Description

Claimed in #14 as RT-PRESENTX. Depends on: the stack up to #403 (their commits come first here; this pull request is the last two commits).

What and why

After #403 the retail title reaches its first present: command-queue slot 32, PresentX(plane count, planes, parameters). It is past the PC queue's 19 slots, so main refuses it and nothing can be shown, although main already has the call's implementation (XboxPresentation, xbox_present.h).

Two commits:

  1. Mine: queue slot 32 calls XboxPresentation::PresentX. The first call on a device builds a window and the Vulkan layer's presenter for it, once, and the state dies with the device proxy. A device that cannot present answers S_OK and shows nothing, so the frame loop runs either way; the mock and COM builds of the file have no presenter and answer S_OK. It follows old PR 2490's wiring (Nolan Cotter, 2be25cee2), written again for main's queue proxy, where that commit does not apply.
  2. afb14d56c by Logan (-x, authorship kept; an ancestor of main whose content is not in the tree): device slot 80 (WaitFrameEventX) and the presentation's pacer share one FrameTokenSource. Without it the title waits through the device, gets tokens from the device's own counter and presents them to a pacer that never issued them. Adapted to main: the uncapped pacer path issues from the shared source too, and the queue's PresentX hands the device's source to its XboxPresentation.

Left out on purpose:

  • The older console queue layout, which has PresentX at slot 30. Only slot 32 is measured on this title.
  • Presenting into the title's own window (old PR 8591). The window here is one this layer creates; that is an assumption marked in the code.

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 The present call in the trace
up to #403 XboxID3D12CommandQueue::Slot32 unsupported
+ commit 1 only PresentX ready (window ...), then XboxPresentation::PresentX failed
+ commit 2, and the list fix of the next pull request XboxPresentation::PresentX ok

The last row is the first successful present on this path. Two honest limits on it:

  • I have it in one of two runs. In the other, an int3 of the title on a worker thread came first; that stop is there in every run now and is a race with the present, not caused by it. I have not looked at it yet.
  • I did not get a run with commit 2 and without the next pull request's list fix that reached the present, for the same reason, so the table's last row has both.

I have not looked at what is on screen. At this point of the boot the integration branch (#321) shows a black frame.

Tests under Wine: xs_proxy_mock_test passes; frame_pacer_test exits 0; xbox_present_test: all cases pass (both have the cases that came with afb14d56c).

Not built with MSVC and not run on Windows. device_proxy_test gets a case from afb14d56c that I cannot run here.

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/414 **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:** `presentx-queue-slot32` --- ### 📝 Commits (10+) - [`522faa2`](https://github.com/ubiquitarianism/leonida/commit/522faa2ee4ad77b00d11057543497f9e31c3ff05) d3d12_xs: honour __XMemAllocationHooks__ for descriptor heaps and translate CPU handles - [`f59167e`](https://github.com/ubiquitarianism/leonida/commit/f59167ef9ce47c3861a2c3f4092c6d4ccdb623e5) d3d12_xs: device slot 25 pads a render target to whole console tiles (RT-5 stop 17) - [`6b75cba`](https://github.com/ubiquitarianism/leonida/commit/6b75cbafbc9e909747c7576dc7123f4d78b4123f) d3d12_xs: device slot 25 gives the PC device clean resource descriptions (RT-5 stop 16) - [`8eaccde`](https://github.com/ubiquitarianism/leonida/commit/8eaccded7f8ea0292046f097d934f73015e3c670) d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums - [`e090be9`](https://github.com/ubiquitarianism/leonida/commit/e090be908ded3ebe84a04702e6690bd98d2cefe7) d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17) - [`24914e7`](https://github.com/ubiquitarianism/leonida/commit/24914e72982aff3da606199eb1bb783fbaa18457) d3d12: preserve PC descriptor validation in slot 25 - [`4056d18`](https://github.com/ubiquitarianism/leonida/commit/4056d185e7e30c90df32a095cf0d30d93b20d507) ladder: kXboxTiledResourceLayout is inline const, not constexpr (clang-cl rejects 0x101 for the unfixed enum) - [`c108c53`](https://github.com/ubiquitarianism/leonida/commit/c108c5389467128dffc1414e112c8b699e724894) d3d12_xs: the console render-target sizes of slots 25 and 56 are for console-form calls only - [`0c5a146`](https://github.com/ubiquitarianism/leonida/commit/0c5a14659502a32d84c830880bc2c20aa1562c11) d3d12_xs: the hook-backed descriptor address is not applied to a console-extended heap - [`c8247cd`](https://github.com/ubiquitarianism/leonida/commit/c8247cdfa384189ed28512aa157663f4db152273) d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41) ### 📊 Changes **23 files changed** (+2257 additions, -123 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+31 -2) 📝 `runtime/CMakeLists.txt` (+1 -0) 📝 `runtime/shims/d3d12_com.cpp` (+10 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+5 -0) 📝 `runtime/shims/d3d12_xs.cpp` (+17 -0) ➕ `runtime/shims/d3d12_xs_alloc_size.h` (+156 -0) ➕ `runtime/shims/d3d12_xs_desc_clean.h` (+38 -0) 📝 `runtime/shims/d3d12_xs_device.cpp` (+860 -52) 📝 `runtime/shims/d3d12_xs_device.h` (+54 -11) 📝 `runtime/shims/registry.cpp` (+39 -0) 📝 `runtime/shims/shims.h` (+13 -0) 📝 `runtime/shims/xbox_present.cpp` (+3 -2) 📝 `runtime/shims/xbox_present.h` (+2 -1) 📝 `runtime/src/command_list.h` (+3 -0) 📝 `runtime/src/frame_pacer.h` (+19 -6) 📝 `runtime/src/pe_loader.cpp` (+7 -0) 📝 `runtime/test/allocator_proxy_test.cpp` (+24 -7) 📝 `runtime/test/d3d12_mesh_test.cpp` (+22 -0) 📝 `runtime/test/device_proxy_test.cpp` (+76 -1) 📝 `runtime/test/frame_pacer_test.cpp` (+19 -0) _...and 3 more files_ </details> ### 📄 Description Claimed in #14 as `RT-PRESENTX`. Depends on: the stack up to #403 (their commits come first here; this pull request is the last two commits). ### What and why After #403 the retail title reaches its first present: command-queue slot 32, `PresentX(plane count, planes, parameters)`. It is past the PC queue's 19 slots, so `main` refuses it and nothing can be shown, although `main` already has the call's implementation (`XboxPresentation`, `xbox_present.h`). Two commits: 1. **Mine**: queue slot 32 calls `XboxPresentation::PresentX`. The first call on a device builds a window and the Vulkan layer's presenter for it, once, and the state dies with the device proxy. A device that cannot present answers `S_OK` and shows nothing, so the frame loop runs either way; the mock and COM builds of the file have no presenter and answer `S_OK`. It follows old PR 2490's wiring (Nolan Cotter, `2be25cee2`), written again for `main`'s queue proxy, where that commit does not apply. 2. **`afb14d56c` by Logan** (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree): device slot 80 (`WaitFrameEventX`) and the presentation's pacer share one `FrameTokenSource`. Without it the title waits through the device, gets tokens from the device's own counter and presents them to a pacer that never issued them. Adapted to `main`: the uncapped pacer path issues from the shared source too, and the queue's PresentX hands the device's source to its `XboxPresentation`. Left out on purpose: - The older console queue layout, which has PresentX at slot 30. Only slot 32 is measured on this title. - Presenting into the title's own window (old PR 8591). The window here is one this layer creates; that is an **assumption** marked in the code. ### 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` | The present call in the trace | |---|---| | up to #403 | `XboxID3D12CommandQueue::Slot32 unsupported` | | + commit 1 only | `PresentX ready (window ...)`, then `XboxPresentation::PresentX failed` | | + commit 2, and the list fix of the next pull request | `XboxPresentation::PresentX ok` | The last row is the first successful present on this path. Two honest limits on it: - I have it in one of two runs. In the other, an `int3` of the title on a worker thread came first; that stop is there in every run now and is a race with the present, not caused by it. I have not looked at it yet. - I did not get a run with commit 2 and without the next pull request's list fix that reached the present, for the same reason, so the table's last row has both. I have not looked at what is on screen. At this point of the boot the integration branch (#321) shows a black frame. Tests under Wine: `xs_proxy_mock_test` passes; `frame_pacer_test` exits 0; `xbox_present_test`: all cases pass (both have the cases that came with `afb14d56c`). Not built with MSVC and not run on Windows. `device_proxy_test` gets a case from `afb14d56c` that I cannot run here. 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:58 +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#467
No description provided.