[PR #261] [MERGED] d3d12: support Xbox depth/stencil UAVs on committed and placed textures (D3D-991) #313

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

📋 Pull Request Information

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

Base: main ← Head: old-pr/9991


📝 Commits (6)

  • 943df64 d3d12: support Xbox R32G8X24 depth and stencil UAVs (D3D-991, part 1)
  • 73b52fb d3d12: complete placed depth UAV arrays and fenced queue transfers (D3D-991)
  • 6ff0560 d3d12: support Xbox depth UAVs through CreateCommittedResource3 (D3D-991)
  • f69c56d Merge upstream main and reconcile Xbox slot 133 placement (D3D-991)
  • 1d5f9b0 Preserve generic placed resource handling with a committed-only depth provider (D3D-991)
  • 632cb75 Merge upstream documentation updates into D3D-991

📊 Changes

23 files changed (+1824 additions, -82 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+18 -0)
📝 runtime/CMakeLists.txt (+19 -0)
📝 runtime/shims/d3d12_com.cpp (+2 -0)
📝 runtime/shims/d3d12_com.h (+6 -2)
📝 runtime/shims/d3d12_vulkan_device.cpp (+194 -25)
📝 runtime/shims/d3d12_xs_device.cpp (+86 -17)
📝 runtime/shims/d3d12_xs_device.h (+34 -5)
➕ runtime/shims/d3d12_xs_placed_depth.h (+125 -0)
📝 runtime/src/queue_families.h (+10 -0)
📝 runtime/src/vulkan_backend.h (+11 -4)
📝 runtime/src/vulkan_bindless.h (+7 -2)
📝 runtime/src/vulkan_replay.h (+231 -23)
📝 runtime/src/vulkan_scratch.h (+7 -2)
➕ runtime/test/d3d12_depth_stencil_uav_test.cpp (+556 -0)
➕ runtime/test/d3d12_depth_stencil_uav_views.h (+79 -0)
➕ runtime/test/d3d12_placed_depth_test.h (+115 -0)
📝 runtime/test/device_proxy_test.cpp (+16 -0)
➕ runtime/test/glsl/cs_depth_stencil_uav.comp (+55 -0)
📝 runtime/test/replay_texture_barrier_test.cpp (+175 -0)
📝 runtime/test/replay_uav_clear_offset_test.cpp (+38 -0)

...and 3 more files

📄 Description

Carried over from old PR 9991 by channa317 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9991, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
channa317: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Re-submission of #9480 (D3D-991). The original PR was closed during the repository-wide closure. This branch preserves its commits and incorporates the subsequent slot 133 work from main. Original claim · Recovery discussion

Resource creation and synchronization

This change lets an Xbox shader read and write depth/stencil planes through a UAV and makes those writes visible when the game uses the depth attachment again. It supports single-sample, single-mip 2D textures and arrays in two format families. R16_TYPELESS exposes raw depth bits through R16_UINT. R32G8X24_TYPELESS exposes depth through R32_FLOAT and stencil through R8_UINT.

  • Slot 76 supports committed textures. The Xbox-bound Device10 backend also accepts CreateCommittedResource3 calls forwarded by the boot stack's slot 127. Allocation queries return the attachment's guest placement size for XMem accounting.
  • Slot 133 interprets the initial argument as a D3D12_BARRIER_LAYOUT and validates it against the logical texture flags before creating or reusing an alias. Compatible live aliases share the GPU contents and retain separate COM identities. Incompatible or overlapping placements are refused. Buffers and other resources keep the upstream generic handler. A regression test covers a device with only the committed-depth provider registered.
  • Legacy and enhanced barriers synchronize the selected planes and array layers. Graphics and compute queues exchange shader writes through fences. Dedicated compute-family transfers use the device's per-format capabilities.

Validation

Windows 11 Pro for Workstations x64 build 26300, Core i9-14900K, 128 GB RAM, RTX 4090 with NVIDIA 621.14, Release x64, MSVC 19.44, Windows SDK 10.0.26100.0, glslang 16.6.0 and Khronos validation layer 1.4.363.1. All local fixtures were synthetic.

  • 23/23 focused CTest cases passed, zero skips. All 13 depth UAV GPU cases matched every pixel, including untouched planes and array slices, with Vulkan synchronization validation enabled and no validation errors. The runtime sources tested at 1d5f9b080 are identical to those in the submitted head 632cb75ad.
  • For those runs, the test build included a temporary correction for three independently reproduced slot 14 descriptor-heap build errors on upstream main. The submitted branch does not include that correction. The unmodified branch and upstream both hit the same three source locations. Upstream report · Separate proposed fix
  • The translator suite on the branch ran 6,046 tests across 459 files. The two failing modules, test_exec_computed and test_image_atomics_guard, reproduced with the same failing assertions on the upstream baseline 2d53a8055.
  • On the preceding 6ff056074 integration build, the boot-stack slot 127 forwarder created the previously refused R16 textures with 1, 3 and 6 layers. The XMem hooks charged and freed each allocation once. AAyberkU independently observed all three creations succeeding in a retail run using 73b52fbfe and local routing changes. A different object still failed later in that run. Retail boot on this submitted head is unverified. Retail report
  • Git's three-way merge check passed against main@d083a2cc3. The no-game-data check passed for all 23 changed files.

Boot-stack integration

Depends on: #7052 (Xbox slot 127 forwarding)

Depends on: #7110 (Xbox resource allocation sizing)

Depends on: #7679 (slot 25 sizing in the integration stack)

The XMem accounting comparison used #7235. Hubcio511 and danekbiglike documented the earlier plane round-trip and placed R16 array work. Original integration notes

AI-assisted (Codex).


🔄 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/261 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `old-pr/9991` --- ### 📝 Commits (6) - [`943df64`](https://github.com/ubiquitarianism/leonida/commit/943df6400d191e6a35e83ac37f45581e56e35a0b) d3d12: support Xbox R32G8X24 depth and stencil UAVs (D3D-991, part 1) - [`73b52fb`](https://github.com/ubiquitarianism/leonida/commit/73b52fbfe4c97e1976c5f781e5c46643f9156311) d3d12: complete placed depth UAV arrays and fenced queue transfers (D3D-991) - [`6ff0560`](https://github.com/ubiquitarianism/leonida/commit/6ff056074a99eabbc0aee77fa34ade559843c3ec) d3d12: support Xbox depth UAVs through CreateCommittedResource3 (D3D-991) - [`f69c56d`](https://github.com/ubiquitarianism/leonida/commit/f69c56d20f415c77684252b912d095b286c26ce1) Merge upstream main and reconcile Xbox slot 133 placement (D3D-991) - [`1d5f9b0`](https://github.com/ubiquitarianism/leonida/commit/1d5f9b0807e2a9e0947a5cee0ba4af08a7c2add1) Preserve generic placed resource handling with a committed-only depth provider (D3D-991) - [`632cb75`](https://github.com/ubiquitarianism/leonida/commit/632cb75ad5c78409ebd151d8396519a985108fea) Merge upstream documentation updates into D3D-991 ### 📊 Changes **23 files changed** (+1824 additions, -82 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+18 -0) 📝 `runtime/CMakeLists.txt` (+19 -0) 📝 `runtime/shims/d3d12_com.cpp` (+2 -0) 📝 `runtime/shims/d3d12_com.h` (+6 -2) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+194 -25) 📝 `runtime/shims/d3d12_xs_device.cpp` (+86 -17) 📝 `runtime/shims/d3d12_xs_device.h` (+34 -5) ➕ `runtime/shims/d3d12_xs_placed_depth.h` (+125 -0) 📝 `runtime/src/queue_families.h` (+10 -0) 📝 `runtime/src/vulkan_backend.h` (+11 -4) 📝 `runtime/src/vulkan_bindless.h` (+7 -2) 📝 `runtime/src/vulkan_replay.h` (+231 -23) 📝 `runtime/src/vulkan_scratch.h` (+7 -2) ➕ `runtime/test/d3d12_depth_stencil_uav_test.cpp` (+556 -0) ➕ `runtime/test/d3d12_depth_stencil_uav_views.h` (+79 -0) ➕ `runtime/test/d3d12_placed_depth_test.h` (+115 -0) 📝 `runtime/test/device_proxy_test.cpp` (+16 -0) ➕ `runtime/test/glsl/cs_depth_stencil_uav.comp` (+55 -0) 📝 `runtime/test/replay_texture_barrier_test.cpp` (+175 -0) 📝 `runtime/test/replay_uav_clear_offset_test.cpp` (+38 -0) _...and 3 more files_ </details> ### 📄 Description > Carried over from **old PR 9991** by `channa317` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9991`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `channa317`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Re-submission of `#9480` (D3D-991). The original PR was closed during the repository-wide closure. This branch preserves its commits and incorporates the subsequent slot 133 work from main. [Original claim](https://github.com/ProjectLeonida/Leonida/issues/9065#issuecomment-7112838194) · [Recovery discussion](https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116396063) ## Resource creation and synchronization This change lets an Xbox shader read and write depth/stencil planes through a UAV and makes those writes visible when the game uses the depth attachment again. It supports single-sample, single-mip 2D textures and arrays in two format families. `R16_TYPELESS` exposes raw depth bits through `R16_UINT`. `R32G8X24_TYPELESS` exposes depth through `R32_FLOAT` and stencil through `R8_UINT`. - Slot 76 supports committed textures. The Xbox-bound Device10 backend also accepts `CreateCommittedResource3` calls forwarded by the boot stack's slot 127. Allocation queries return the attachment's guest placement size for XMem accounting. - Slot 133 interprets the initial argument as a `D3D12_BARRIER_LAYOUT` and validates it against the logical texture flags before creating or reusing an alias. Compatible live aliases share the GPU contents and retain separate COM identities. Incompatible or overlapping placements are refused. Buffers and other resources keep the upstream generic handler. A regression test covers a device with only the committed-depth provider registered. - Legacy and enhanced barriers synchronize the selected planes and array layers. Graphics and compute queues exchange shader writes through fences. Dedicated compute-family transfers use the device's per-format capabilities. ## Validation Windows 11 Pro for Workstations x64 build 26300, Core i9-14900K, 128 GB RAM, RTX 4090 with NVIDIA 621.14, Release x64, MSVC 19.44, Windows SDK 10.0.26100.0, glslang 16.6.0 and Khronos validation layer 1.4.363.1. All local fixtures were synthetic. - **23/23 focused CTest cases passed, zero skips.** All **13 depth UAV GPU cases** matched every pixel, including untouched planes and array slices, with Vulkan synchronization validation enabled and no validation errors. The runtime sources tested at `1d5f9b080` are identical to those in the submitted head `632cb75ad`. - For those runs, the test build included a temporary correction for three independently reproduced slot 14 descriptor-heap build errors on upstream `main`. The submitted branch does not include that correction. The unmodified branch and upstream both hit the same three source locations. [Upstream report](https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116454593) · [Separate proposed fix](https://github.com/ProjectLeonida/Leonida/pull/9873) - The translator suite on the branch ran 6,046 tests across 459 files. The two failing modules, `test_exec_computed` and `test_image_atomics_guard`, reproduced with the same failing assertions on the upstream baseline `2d53a8055`. - On the preceding `6ff056074` integration build, the boot-stack slot 127 forwarder created the previously refused R16 textures with 1, 3 and 6 layers. The XMem hooks charged and freed each allocation once. AAyberkU independently observed all three creations succeeding in a retail run using `73b52fbfe` and local routing changes. A different object still failed later in that run. Retail boot on this submitted head is unverified. [Retail report](https://github.com/ProjectLeonida/Leonida/pull/9480#issuecomment-7115553189) - Git's three-way merge check passed against `main@d083a2cc3`. The no-game-data check passed for all 23 changed files. ## Boot-stack integration Depends on: `#7052` (Xbox slot 127 forwarding) Depends on: `#7110` (Xbox resource allocation sizing) Depends on: `#7679` (slot 25 sizing in the integration stack) The XMem accounting comparison used `#7235`. Hubcio511 and danekbiglike documented the earlier plane round-trip and placed R16 array work. [Original integration notes](https://github.com/ProjectLeonida/Leonida/pull/9480) AI-assisted (Codex). --- <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:28 +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#313
No description provided.