[PR #432] [CLOSED] d3d12_xs: fence slot 12 returns the address of a live completed value, again; the retail boot reaches its frame loop (RT-FENCE12) #484

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/432
Author: @Mumogg
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: fence-slot12-completed-value


📝 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

24 files changed (+2760 additions, -129 deletions)

View changed files

📝 docs/d3d12_command_objects.md (+6 -0)
📝 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 (+55 -0)
📝 runtime/shims/d3d12_xs_device.cpp (+1075 -54)
📝 runtime/shims/d3d12_xs_device.h (+56 -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 (+114 -1)

...and 4 more files

📄 Description

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

What and why

Fence slot 12 is one past ID3D12Fence1. The retail title calls it as (value, descriptor, flags) and reads the return as a pointer to the fence's 64-bit completed value. main refuses the slot with E_NOTIMPL, and the title dereferences the error code.

Commit 5ac4deaa2 by TreXito (-x, authorship kept; an ancestor of main whose content is not in the tree): each fence gets a mirror of its completed value that stays current without the title calling anything (a thread-pool wait on the real fence refreshes it; slot 12 and a CPU Signal refresh it at once), and slot 12 returns the mirror's address. The descriptor's code pointer is not called: its contract is not known, and the commit says so.

The conflicts were neighbours (the queue constants of #391 and #403, the allocator fields of #395, the tests' lists); both sides are kept.

Measured: the frame loop

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, #387 and #428 applied on top (they are not in this branch).

Correction (I first posted this section with a wrong duration): the runs with this change do not last the 300 s I allowed them. The process ends after about 30 s, exit code 3. I had read the counts and not the exit line. The numbers below are two runs of about 30 s each.

--run up to #430 + this, run 1 + this, run 2
Traced D3D12 calls 62,599 537,677 577,901
CreatePipelineState ok 50,450 50,466 (4 failed) same
ExecuteCommandLists ok 5 26,400, none failed not counted separately
DrawInstanced 0 13,200 14,317
XboxPresentation::PresentX ok 1 13,199, none failed 14,316
Ends with the title writing through a null pointer after Fence::Slot12 unsupported exit 3 at about 30 s exit 3 at 30 s

So with this the retail title enters its frame loop on main here and presents some 13,000 to 14,000 times, with one draw per present, before the process ends. That is far more presents than seconds: nothing paces the loop on this path.

Why it ends, from run 2's startup trace: at 22.4 s a worker thread of the title hits its own int3 (the size check of #427 and #428, on a third description that I have not identified yet); at 28 to 29 s the title's crash reporting runs and the process exits. The frame loop is running the whole time in between. So the next thing on this path is that third description, not the loop.

What else is still wrong, so nobody reads more into the table than it says:

  • I have not looked at the picture. On the integration branch (#321) this point of the boot shows a black frame.
  • Four pipeline states fail with primitive topology type not supported: 19: rectangle lists, which main does not draw (old PR 7448). The integration branch draws three times per present, this path once; that is very likely why.
  • XboxID3D12CommandQueue::Slot31 is refused twice.

Tests under Wine: xs_proxy_mock_test passes with the commit's check_fence_completed_value; queue_proxy_test passes on the Vulkan backend with its fence slot 12 case (the value follows a queue's signal without another call).

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/432 **Author:** [@Mumogg](https://github.com/Mumogg) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fence-slot12-completed-value` --- ### 📝 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 **24 files changed** (+2760 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_command_objects.md` (+6 -0) 📝 `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` (+55 -0) 📝 `runtime/shims/d3d12_xs_device.cpp` (+1075 -54) 📝 `runtime/shims/d3d12_xs_device.h` (+56 -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` (+114 -1) _...and 4 more files_ </details> ### 📄 Description Claimed in #14 as `RT-FENCE12`. Depends on: the stack up to #430 (their commits come first here; this pull request is the last commit). ### What and why Fence slot 12 is one past `ID3D12Fence1`. The retail title calls it as `(value, descriptor, flags)` and reads the return as a pointer to the fence's 64-bit completed value. `main` refuses the slot with `E_NOTIMPL`, and the title dereferences the error code. Commit `5ac4deaa2` by TreXito (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree): each fence gets a mirror of its completed value that stays current without the title calling anything (a thread-pool wait on the real fence refreshes it; slot 12 and a CPU `Signal` refresh it at once), and slot 12 returns the mirror's address. The descriptor's code pointer is not called: its contract is not known, and the commit says so. The conflicts were neighbours (the queue constants of #391 and #403, the allocator fields of #395, the tests' lists); both sides are kept. ### Measured: the frame loop 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, #387 and #428 applied on top (they are not in this branch). **Correction (I first posted this section with a wrong duration):** the runs with this change do not last the 300 s I allowed them. The process ends after about 30 s, exit code 3. I had read the counts and not the exit line. The numbers below are two runs of about 30 s each. | `--run` | up to #430 | + this, run 1 | + this, run 2 | |---|---|---|---| | Traced D3D12 calls | 62,599 | 537,677 | 577,901 | | `CreatePipelineState` ok | 50,450 | 50,466 (4 failed) | same | | `ExecuteCommandLists` ok | 5 | 26,400, none failed | not counted separately | | `DrawInstanced` | 0 | 13,200 | 14,317 | | `XboxPresentation::PresentX` ok | 1 | 13,199, none failed | 14,316 | | Ends with | the title writing through a null pointer after `Fence::Slot12 unsupported` | exit 3 at about 30 s | exit 3 at 30 s | So with this the retail title **enters its frame loop on `main`** here and presents some 13,000 to 14,000 times, with one draw per present, before the process ends. That is far more presents than seconds: nothing paces the loop on this path. Why it ends, from run 2's startup trace: at 22.4 s a worker thread of the title hits its own `int3` (the size check of #427 and #428, on a third description that I have not identified yet); at 28 to 29 s the title's crash reporting runs and the process exits. The frame loop is running the whole time in between. So the next thing on this path is that third description, not the loop. What else is still wrong, so nobody reads more into the table than it says: - **I have not looked at the picture.** On the integration branch (#321) this point of the boot shows a black frame. - Four pipeline states fail with `primitive topology type not supported: 19`: rectangle lists, which `main` does not draw (old PR 7448). The integration branch draws three times per present, this path once; that is very likely why. - `XboxID3D12CommandQueue::Slot31` is refused twice. Tests under Wine: `xs_proxy_mock_test` passes with the commit's `check_fence_completed_value`; `queue_proxy_test` passes on the Vulkan backend with its fence slot 12 case (the value follows a queue's signal without another call). 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:18:02 +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#484
No description provided.