[PR #526] [MERGED] d3d12_xs: keep the Win32 PresentX window responsive during rendering #574

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

📋 Pull Request Information

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

Base: main ← Head: fix/windows-present-window-pump


📝 Commits (10+)

  • 0a71454 d3d12_xs: honour XMemAllocationHooks for descriptor heaps and translate CPU handles
  • 8563343 d3d12_xs: device slot 25 pads a render target to whole console tiles (RT-5 stop 17)
  • 584ef36 d3d12_xs: device slot 25 gives the PC device clean resource descriptions (RT-5 stop 16)
  • f1a68ee d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums
  • 35e687f d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17)
  • 20936e8 d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41)
  • 58ce13c d3d12_xs: read the console argument type as its 32 bits (clang-cl)
  • 3b86f5f d3d12: CreateCommandSignature creates a DISPATCH_MESH signature on a device with mesh shaders
  • f54cf31 d3d12_xs: Xbox device slot 61 is CreateSamplerX, routed to the PC CreateSampler
  • 6d4cf2c d3d12_xs: slot 61 is CreateSamplerX only for the title's calls; a host caller gets PC CreateMetaCommand

📊 Changes

25 files changed (+2317 additions, -133 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+28 -2)
📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/shims/d3d12_com.cpp (+9 -13)
📝 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 (+34 -0)
📝 runtime/shims/d3d12_xs_device.cpp (+833 -50)
📝 runtime/shims/d3d12_xs_device.h (+54 -11)
➕ runtime/shims/present_window.h (+72 -0)
📝 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 (+70 -0)

...and 5 more files

📄 Description

Claimed in the coordination issue as: RT-PRESENTX-WINDOW-PUMP (claim).

Depends on: #414

What and why

The Win32 fallback window created by #414 belongs to the rendering thread. On native Windows the window stopped answering messages during pipeline compilation, and it could still be marked hung while draws and presents continued. Give this HWND a dedicated message thread. Release its Vulkan presenter before waking and joining the window owner on shutdown.

The change to review is ce3e5153f. The preceding PresentX commits are from #414. The title-owned window path is outside this change.

Tested

  • MSVC x64 RelWithDebInfo builds of the runtime and the window, queue and device tests on Windows 11 Pro x64 build 26200.
  • The new hidden-window test passed 25 consecutive runs. It sends synchronous messages while the calling thread does no dispatch, closes one of two windows and destroys the other from a different thread. The queue proxy test passed.
  • On the retail frame-loop integration with the same window-ownership change, the fallback window answered a synchronous WM_NULL probe in 0.08 ms while the game was running. Before the change Windows reported the fallback HWND hung. Captured frames were still black. GPU content is a separate open problem.
  • The device proxy test has two failures in the slot 25 resource-allocation-info checks on this Windows machine. Both fail on the untouched #414 head and on the updated stack.
  • Repository-wide game-data check passed.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro x64. The hidden-window test needs only a Win32 desktop.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Current main is merged into the stack and the branch merges cleanly.
  • One window-lifetime change on top of #414.
  • No game data, keys or decryption.
  • No translator rule changed.

🔄 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/526 **Author:** [@Rain156](https://github.com/Rain156) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `fix/windows-present-window-pump` --- ### 📝 Commits (10+) - [`0a71454`](https://github.com/ubiquitarianism/leonida/commit/0a714544d64974ad43ad26b6de533bc3b15d2c0d) d3d12_xs: honour __XMemAllocationHooks__ for descriptor heaps and translate CPU handles - [`8563343`](https://github.com/ubiquitarianism/leonida/commit/856334399de47b6f6f951a61333425dc3524585b) d3d12_xs: device slot 25 pads a render target to whole console tiles (RT-5 stop 17) - [`584ef36`](https://github.com/ubiquitarianism/leonida/commit/584ef36fa82ca00e19a4a03104b1b0d6ce295bd4) d3d12_xs: device slot 25 gives the PC device clean resource descriptions (RT-5 stop 16) - [`f1a68ee`](https://github.com/ubiquitarianism/leonida/commit/f1a68eeffbf280b2e2c86f439ebd674da026d82e) d3d12_xs: console render target sizes follow each resource's alignment, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums - [`35e687f`](https://github.com/ubiquitarianism/leonida/commit/35e687f2ac1eeca764deffc307c6a076c9a44230) d3d12_xs: committed resources lease their size through the title's XMem hooks (RT-5 stop 17) - [`20936e8`](https://github.com/ubiquitarianism/leonida/commit/20936e84537a25441aa7d8e84fd7fd7073afba82) d3d12_xs: a console indirect argument of type 105 is created as DISPATCH (slot 41) - [`58ce13c`](https://github.com/ubiquitarianism/leonida/commit/58ce13c12d541c32dfbcbb199112d31bf712cb0a) d3d12_xs: read the console argument type as its 32 bits (clang-cl) - [`3b86f5f`](https://github.com/ubiquitarianism/leonida/commit/3b86f5fb3cfa97d2aa8b500768ac72cad7a4dbfa) d3d12: CreateCommandSignature creates a DISPATCH_MESH signature on a device with mesh shaders - [`f54cf31`](https://github.com/ubiquitarianism/leonida/commit/f54cf315b434cc5980c0bc30499e1837291c5b8f) d3d12_xs: Xbox device slot 61 is CreateSamplerX, routed to the PC CreateSampler - [`6d4cf2c`](https://github.com/ubiquitarianism/leonida/commit/6d4cf2ceb705b4d1bf2fdc0611e6431d91718320) d3d12_xs: slot 61 is CreateSamplerX only for the title's calls; a host caller gets PC CreateMetaCommand ### 📊 Changes **25 files changed** (+2317 additions, -133 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+28 -2) 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/shims/d3d12_com.cpp` (+9 -13) 📝 `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` (+34 -0) 📝 `runtime/shims/d3d12_xs_device.cpp` (+833 -50) 📝 `runtime/shims/d3d12_xs_device.h` (+54 -11) ➕ `runtime/shims/present_window.h` (+72 -0) 📝 `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` (+70 -0) _...and 5 more files_ </details> ### 📄 Description Claimed in the coordination issue as: RT-PRESENTX-WINDOW-PUMP ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7124105269)). Depends on: #414 ### What and why The Win32 fallback window created by #414 belongs to the rendering thread. On native Windows the window stopped answering messages during pipeline compilation, and it could still be marked hung while draws and presents continued. Give this HWND a dedicated message thread. Release its Vulkan presenter before waking and joining the window owner on shutdown. The change to review is [ce3e5153f](https://github.com/Rain156/leonida-contrib/commit/ce3e5153f). The preceding PresentX commits are from #414. The title-owned window path is outside this change. ### Tested - MSVC x64 RelWithDebInfo builds of the runtime and the window, queue and device tests on Windows 11 Pro x64 build 26200. - The new hidden-window test passed 25 consecutive runs. It sends synchronous messages while the calling thread does no dispatch, closes one of two windows and destroys the other from a different thread. The queue proxy test passed. - On the retail frame-loop integration with the same window-ownership change, the fallback window answered a synchronous `WM_NULL` probe in 0.08 ms while the game was running. Before the change Windows reported the fallback HWND hung. Captured frames were still black. GPU content is a separate open problem. - The device proxy test has two failures in the slot 25 resource-allocation-info checks on this Windows machine. Both fail on the untouched #414 head and on the updated stack. - Repository-wide game-data check passed. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro x64. The hidden-window test needs only a Win32 desktop. AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Current `main` is merged into the stack and the branch merges cleanly. - [x] One window-lifetime change on top of #414. - [x] No game data, keys or decryption. - [x] No translator rule changed. --- <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:20 +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#574
No description provided.