d3d12_xs: a console volume depth-stencil is a 2D depth array (RT-VOLUME-DEPTH) #961

Closed
roanh47 wants to merge 2 commits from upstream-pr/961 into main
roanh47 commented 2026-11-24 15:52:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by roanh47 on 2026-11-24T15:52:18Z.


Claimed in the coordination issue as: RT-VOLUME-DEPTH

Depends on: #427 and #772. This branch is based on #772's head cbdaf7ece, which contains #427's 89fdb83e0; #427 adds runtime/shims/d3d12_xs_desc_clean.h and the slot-25 descriptor copy, and #772 touches slots 127 and 133. The volume-depth helper is now part of #427's header instead of a second copy of it. This PR's own commit is e0b962d89, the last one in the diff; the earlier commits are that stack (based on main a28927849), which is itself behind today's main, so the stack is not mergeable until #427/#772 are. A test merge with today's main conflicts only where that stack meets newer main changes (docs/d3d12_vulkan.md, runtime/shims/d3d12_xs_device.cpp/.h, runtime/src/frame_pacer.h and the list in xs_proxy_mock_test.cpp's main); this commit's hunks apply on top of #772.

What and why

The current native Windows/RTX 3070 stop after #517 is ID3D12Device10::CreateCommittedResource3 refusing a TEXTURE3D 768x768x6 R16_TYPELESS, one mip, one sample, ALLOW_DEPTH_STENCIL resource. PC D3D12 has no volume depth-stencil: the layer's GetResourceAllocationInfo answers UINT64_MAX and CreateCommittedResource3 fails.

On top of #427's d3d12_xs_desc_clean.h, two small functions describe exactly that measured resource as a TEXTURE2D depth array of the same six slices:

  • is_measured_volume_depth: Dimension == TEXTURE3D, ALLOW_DEPTH_STENCIL, MipLevels == 1, SampleDesc.Count == 1, DepthOrArraySize == 6;
  • pc_depth_desc: a copy with Dimension changed to TEXTURE2D; DepthOrArraySize is already the slice count.

Called where the PC device is handed a description:

  • slot 25 (GetResourceAllocationInfo): inside #427's existing descriptor copy, before the size query, so sizing and creation agree;
  • slot 76 (CreateCommittedResource), slot 127 (CreateCommittedResource3) and the slot 133 (CreatePlacedResourceX) handler: on the existing copy before the PC call.

Preserved exactly: the format (R16_TYPELESS, still typeless in the depth-stencil family), ALLOW_DEPTH_STENCIL, the clear value the caller passes, MipLevels, SampleDesc, width, height and the six array slices. The caller's descriptor is never written.

Deliberately not translated:

  • a multi-mip volume, another slice count or a multisampled volume. A 3D mip shrinks its depth, while a 2D array keeps every layer at every mip, so those shapes are not equivalent; they go on as they came and the PC device's refusal stands. xs_proxy_mock_test proves a four-slice, a two-mip and a colour volume keep TEXTURE3D;
  • the global PC rule in d3d12_vulkan_device.cpp, which is unchanged;
  • console slot 108 (GetResourceAllocationInfo2): it is not routed in this stack's d3d12_xs_device.cpp, so there is no call site to change.

d3d12_vulkan_device_test is not modified in this version: its depth-stencil volume case is four slices, outside the measured shape, and still matches the host runtime.

Tested

MSVC 19.44 (RelWithDebInfo, Visual Studio 17 2022, x64, Windows SDK 10.0.26100), Vulkan SDK 1.4.363.0, on the rebased branch:

cmake --build runtime/build --config RelWithDebInfo --target xs_proxy_mock_test d3d12_vulkan_device_test d3d12_method_variants_test d3d12_resource_desc_test
ctest -C RelWithDebInfo -R "xs_proxy_mock|d3d12_method_variants|d3d12_resource_desc|d3d12_vulkan_device"
 1/10 Test  #27: xs_proxy_mock .....................   Passed    0.01 sec
 2/10 Test  #28: xs_proxy_mock_no_reserve ..........   Passed    0.01 sec
 3/10 Test  #29: xs_proxy_mock_no_protect ..........   Passed    0.01 sec
 4/10 Test  #30: xs_proxy_mock_no_handler ..........   Passed    0.01 sec
 5/10 Test  #31: xs_proxy_mock_env_slots ...........   Passed    0.01 sec
 6/10 Test  #32: xs_proxy_mock_env_slots_invalid ...   Passed    0.01 sec
 7/10 Test  #33: xs_proxy_mock_env_slots_74 ........   Passed    0.01 sec
 8/10 Test #173: d3d12_vulkan_device ...............   Passed   10.55 sec
 9/10 Test #201: d3d12_method_variants .............   Passed    0.94 sec
10/10 Test #221: d3d12_resource_desc ...............   Passed    0.53 sec

100% tests passed, 0 tests failed out of 10
Total Test time (real) =  12.12 sec

The new regression's own lines:

[rt] d3d12_xs: slot 25: measured console TEXTURE3D depth-stencil 768x768x6 (format 53, flags 0x2, one mip, one sample) is described to the PC device as a TEXTURE2D depth array of 6 slices
xs_proxy_mock: the measured console TEXTURE3D 768x768x6 R16_TYPELESS depth-stencil is sized and created as a 2D depth array of six slices, and other volume depths keep their dimension
xs_proxy_mock_test: PASS (10 allocations refused on purpose)

It checks the descriptor through slot 25 (including a two-entry list), slots 76 and 127 and the slot 133 handler, asserts the caller's D3D12_RESOURCE_DESC/DESC1 is byte-identical after every call, and that the four-slice, multi-mip and colour volumes are not converted.

The other tests' closing lines:

D3D12 method variants: CreateCommittedResource1/2/3, CreatePlacedResource2, CreateReservedResource1/2, CreateCommandQueue1 and GetCopyableFootprints1 matched their base methods and the PC runtime's edge-case answers; a texture round-tripped
resource desc against NVIDIA GeForce RTX 3070: 26 of 26 descriptions match, 0 differ, 0 refused by the host, 0 not created by the layer
resource desc against WARP: 26 of 26 descriptions match, 0 differ, 0 refused by the host, 0 not created by the layer
Vulkan device behind the Xbox-ABI proxy: clears, zero-filled first use, uploads, texture, buffer and BC copies, a resolve, reserved resources, queries, GetCopyableFootprints, GetResourceTiling and CheckFeatureSupport error paths and fence semantics all matched

One intermediate ctest run of d3d12_vulkan_device failed once on this stack; it passed when run alone and in the next full run above (no line N: failure printed in the direct run).

python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_desc_clean.h runtime/shims/d3d12_xs_device.cpp runtime/shims/d3d12_xs_device.h runtime/test/xs_proxy_mock_test.cpp exits 0 with no output.

No game data is in the change: every descriptor in the tests is hand-written, and no log or report quotes the title.

GPUs tested: NVIDIA GeForce RTX 3070, driver 610.88, Windows 11 Pro.

AI-assisted: yes (DeepSeek v4.1 Flash 1017).

Checklist

  • Based on the #427+#772 stack (stack head cbdaf7ece, on main a28927849) and merges cleanly once they do.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md — not a translator change.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5475580575 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/961). Originally posted by [roanh47](https://github.com/roanh47) on 2026-11-24T15:52:18Z. --- Claimed in the coordination issue as: [RT-VOLUME-DEPTH](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135719148) Depends on: #427 and #772. This branch is based on #772's head `cbdaf7ece`, which contains #427's `89fdb83e0`; #427 adds `runtime/shims/d3d12_xs_desc_clean.h` and the slot-25 descriptor copy, and #772 touches slots 127 and 133. The volume-depth helper is now part of #427's header instead of a second copy of it. This PR's own commit is `e0b962d89`, the last one in the diff; the earlier commits are that stack (based on `main` `a28927849`), which is itself behind today's `main`, so the stack is not mergeable until #427/#772 are. A test merge with today's `main` conflicts only where that stack meets newer `main` changes (`docs/d3d12_vulkan.md`, `runtime/shims/d3d12_xs_device.cpp`/`.h`, `runtime/src/frame_pacer.h` and the list in `xs_proxy_mock_test.cpp`'s `main`); this commit's hunks apply on top of #772. ### What and why The current native Windows/RTX 3070 stop after #517 is `ID3D12Device10::CreateCommittedResource3` refusing a `TEXTURE3D 768x768x6 R16_TYPELESS`, one mip, one sample, `ALLOW_DEPTH_STENCIL` resource. PC D3D12 has no volume depth-stencil: the layer's `GetResourceAllocationInfo` answers `UINT64_MAX` and `CreateCommittedResource3` fails. On top of #427's `d3d12_xs_desc_clean.h`, two small functions describe exactly that measured resource as a `TEXTURE2D` depth array of the same six slices: - `is_measured_volume_depth`: `Dimension == TEXTURE3D`, `ALLOW_DEPTH_STENCIL`, `MipLevels == 1`, `SampleDesc.Count == 1`, `DepthOrArraySize == 6`; - `pc_depth_desc`: a copy with `Dimension` changed to `TEXTURE2D`; `DepthOrArraySize` is already the slice count. Called where the PC device is handed a description: - **slot 25** (`GetResourceAllocationInfo`): inside #427's existing descriptor copy, before the size query, so sizing and creation agree; - **slot 76** (`CreateCommittedResource`), **slot 127** (`CreateCommittedResource3`) and the **slot 133** (`CreatePlacedResourceX`) handler: on the existing copy before the PC call. Preserved exactly: the format (`R16_TYPELESS`, still typeless in the depth-stencil family), `ALLOW_DEPTH_STENCIL`, the clear value the caller passes, `MipLevels`, `SampleDesc`, width, height and the six array slices. The caller's descriptor is never written. Deliberately **not** translated: - a multi-mip volume, another slice count or a multisampled volume. A 3D mip shrinks its depth, while a 2D array keeps every layer at every mip, so those shapes are not equivalent; they go on as they came and the PC device's refusal stands. `xs_proxy_mock_test` proves a four-slice, a two-mip and a colour volume keep `TEXTURE3D`; - the global PC rule in `d3d12_vulkan_device.cpp`, which is unchanged; - console slot 108 (`GetResourceAllocationInfo2`): it is not routed in this stack's `d3d12_xs_device.cpp`, so there is no call site to change. `d3d12_vulkan_device_test` is not modified in this version: its depth-stencil volume case is four slices, outside the measured shape, and still matches the host runtime. ### Tested MSVC 19.44 (`RelWithDebInfo`, `Visual Studio 17 2022`, x64, Windows SDK 10.0.26100), Vulkan SDK 1.4.363.0, on the rebased branch: ``` cmake --build runtime/build --config RelWithDebInfo --target xs_proxy_mock_test d3d12_vulkan_device_test d3d12_method_variants_test d3d12_resource_desc_test ctest -C RelWithDebInfo -R "xs_proxy_mock|d3d12_method_variants|d3d12_resource_desc|d3d12_vulkan_device" ``` ``` 1/10 Test #27: xs_proxy_mock ..................... Passed 0.01 sec 2/10 Test #28: xs_proxy_mock_no_reserve .......... Passed 0.01 sec 3/10 Test #29: xs_proxy_mock_no_protect .......... Passed 0.01 sec 4/10 Test #30: xs_proxy_mock_no_handler .......... Passed 0.01 sec 5/10 Test #31: xs_proxy_mock_env_slots ........... Passed 0.01 sec 6/10 Test #32: xs_proxy_mock_env_slots_invalid ... Passed 0.01 sec 7/10 Test #33: xs_proxy_mock_env_slots_74 ........ Passed 0.01 sec 8/10 Test #173: d3d12_vulkan_device ............... Passed 10.55 sec 9/10 Test #201: d3d12_method_variants ............. Passed 0.94 sec 10/10 Test #221: d3d12_resource_desc ............... Passed 0.53 sec 100% tests passed, 0 tests failed out of 10 Total Test time (real) = 12.12 sec ``` The new regression's own lines: ``` [rt] d3d12_xs: slot 25: measured console TEXTURE3D depth-stencil 768x768x6 (format 53, flags 0x2, one mip, one sample) is described to the PC device as a TEXTURE2D depth array of 6 slices xs_proxy_mock: the measured console TEXTURE3D 768x768x6 R16_TYPELESS depth-stencil is sized and created as a 2D depth array of six slices, and other volume depths keep their dimension xs_proxy_mock_test: PASS (10 allocations refused on purpose) ``` It checks the descriptor through slot 25 (including a two-entry list), slots 76 and 127 and the slot 133 handler, asserts the caller's `D3D12_RESOURCE_DESC`/`DESC1` is byte-identical after every call, and that the four-slice, multi-mip and colour volumes are not converted. The other tests' closing lines: ``` D3D12 method variants: CreateCommittedResource1/2/3, CreatePlacedResource2, CreateReservedResource1/2, CreateCommandQueue1 and GetCopyableFootprints1 matched their base methods and the PC runtime's edge-case answers; a texture round-tripped resource desc against NVIDIA GeForce RTX 3070: 26 of 26 descriptions match, 0 differ, 0 refused by the host, 0 not created by the layer resource desc against WARP: 26 of 26 descriptions match, 0 differ, 0 refused by the host, 0 not created by the layer Vulkan device behind the Xbox-ABI proxy: clears, zero-filled first use, uploads, texture, buffer and BC copies, a resolve, reserved resources, queries, GetCopyableFootprints, GetResourceTiling and CheckFeatureSupport error paths and fence semantics all matched ``` One intermediate `ctest` run of `d3d12_vulkan_device` failed once on this stack; it passed when run alone and in the next full run above (no `line N:` failure printed in the direct run). `python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_desc_clean.h runtime/shims/d3d12_xs_device.cpp runtime/shims/d3d12_xs_device.h runtime/test/xs_proxy_mock_test.cpp` exits 0 with no output. No game data is in the change: every descriptor in the tests is hand-written, and no log or report quotes the title. GPUs tested: NVIDIA GeForce RTX 3070, driver 610.88, Windows 11 Pro. AI-assisted: yes (DeepSeek v4.1 Flash 1017). ### Checklist - [x] Based on the #427+#772 stack (stack head `cbdaf7ece`, on `main` `a28927849`) and merges cleanly once they do. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md` — not a translator change.
copilot-pull-request-reviewer[bot] commented 2026-11-24 15:52:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T15:52:29Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6042660689 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/961#pullrequestreview-6042660689). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-24T15:52:29Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
bobcatchris commented 2026-11-24 19:05:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-24T19:05:40Z.


Independent evidence from the overlapping PR I just closed: on Windows 11 / RX 7900 XTX / driver 32.0.32029.2010, a synthetic native D3D12 probe accepted a TEXTURE3D 4x4x4 R16_TYPELESS ALLOW_DEPTH_STENCIL resource and a TEXTURE2D DSV into it. @Dezmonius also measured native CreateCommittedResource S_OK on WARP and RTX 5070, plus a validation-clean raw Vulkan 3D D16 slice-clear/readback probe. The statement that PC D3D12 has no volume depth-stencil may therefore be runtime/driver-specific. Your Xbox-proxy normalization can still be the right retail fix; I am not pursuing the global-layer alternative.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141588223 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/961#issuecomment-7141588223). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-24T19:05:40Z. --- Independent evidence from the overlapping PR I just closed: on Windows 11 / RX 7900 XTX / driver 32.0.32029.2010, a synthetic native D3D12 probe accepted a TEXTURE3D 4x4x4 R16_TYPELESS ALLOW_DEPTH_STENCIL resource and a TEXTURE2D DSV into it. @Dezmonius also measured native CreateCommittedResource S_OK on WARP and RTX 5070, plus a validation-clean raw Vulkan 3D D16 slice-clear/readback probe. The statement that PC D3D12 has no volume depth-stencil may therefore be runtime/driver-specific. Your Xbox-proxy normalization can still be the right retail fix; I am not pursuing the global-layer alternative.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!961
No description provided.