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

Closed
github-bot wants to merge 31 commits from gh-pr/961/head into gh-pr/961/base
Owner

@⁠roanh47 on GitHub · 2026-11-24 15:52 UTC · original
pr/volume-depth → main · +2706 −134 · 23 files · 31 commits · closed without merging

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.
**@⁠roanh47** on GitHub · 2026-11-24 15:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/961) `pr/volume-depth` → `main` · +2706 −134 · 23 files · 31 commits · closed without merging Claimed in the coordination issue as: [RT-VOLUME-DEPTH](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) 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.
(cherry picked from commit 355201c51e)
The retail title asserts when its first full-screen render targets leave more than 2 MiB of a fixed budget unused (docs/retail_boot_chain.md, #6982). The PC size is about width x height x element bytes; the console takes whole RDNA2 SW_64KB tiles. Slot 25 adds the difference per render target description and never lowers a size. Depends on #6973.

(cherry picked from commit 8897855399)
The title's descriptions carry the Xbox layout word and flag bits above the PC ones. Slot 25 now passes a copy with PC flags and a PC layout; the title's array is not written. Depends on #7078.

(cherry picked from commit c7ca0f2d1c)
(cherry picked from commit 359390833f)
On the console a committed resource's memory is allocated with XMemAlloc, so it goes
through the title's __XMemAllocationHooks__. The retail title budgets its first
full-screen render targets with a per-thread hook that bump-allocates out of a range it
reserved and asserts that less than 2 MiB is left; PC resources never allocated through
the hooks, so the assert always fired. Slots 76 and 127 now allocate the slot-25 size of
each resource through the hooks, held by the resource with SetPrivateDataInterface and
freed when it is destroyed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ae322dafc5)

Adapted to main by Mumogg: the lease size is the later form of this series (d61755d4d, a render target's console
tile size, else the PC size), since console_render_target_extra is gone after 359390833.
(cherry picked from commit b4d1ba1794)
Reported by YaBulochka and sovljanskii on #7154; #7110's current head has the same form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit bee47186f6)
With the console tile sizes applied to every caller, a PC-form call through the proxy no longer answered what the
PC device answers, and the code that compares the two failed on Windows: device_proxy_test's two slot 25 checks
and d3d12_vulkan_device_test's allocation_mismatches (reported on #375 from MSVC builds on AMD and NVIDIA, the
first bad commit being the one that cleans the descriptions). Together with b4d1ba179, which scopes the cleaning
the same way, a PC-form caller now gets the PC device's own answer for its own description; the title's call,
which comes in the console form, gets the cleaned description and the console sizes as before.

xs_proxy_mock_test: the PC-form slot 25 case expects the mock device's size (it expected the console size), and
the mixed slot 56 case is asked in the console form. device_proxy_test includes d3d12_xs_desc_clean.h for the
cleaned description b4d1ba179's check compares with.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
A heap that main's console-extended handler created already sits at the address the title named, so
proxy_create_descriptor_heap asks the title's XMem hooks for a backing address only when the heap came from a
plain PC description (follow-up asked for in review on #375).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title creates five one-argument command signatures with no root
signature at startup (device slot 41, CreateCommandSignature at its PC
position). One has the console argument type 105 and a 12-byte stride, next
to a DISPATCH and a DISPATCH_MESH of 12 bytes. The PC layer refuses the
unknown type, which is stop 19 of the RT-5 boot measurements.

Read statically from the title's call sites (shapes only): the two
ExecuteIndirect sites of that signature pass MaxCommandCount 1 and an offset
into the same argument buffer as the DISPATCH sites. Right before, they set
the same compute state as the DISPATCH path (pipeline, compute root signature,
tables, constants, SRV and UAV); they record on a second command list of the
title's context. So the argument is taken as a D3D12_DISPATCH_ARGUMENTS.

Slot 41 now has its own handler. A description that holds type 105 is copied
with that type replaced by DISPATCH (logged once). Any other description is
forwarded as the same pointer. What the console does differently for type 105
is left open in docs/d3d12_vulkan.md (section 4.9).

xs_proxy_mock_test: a two-argument description (a root constant, then type
105) reaches the PC slot 41 as a copy with DISPATCH, the same stride, count,
root signature, IID and output, and the caller's description is untouched; a
PC description is passed through unchanged. With main's d3d12_xs_device.cpp
the new check fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 4c04c0f4e3)
105 is outside D3D12_INDIRECT_ARGUMENT_TYPE's range [0, 15], so clang-cl
rejects a constant expression that casts it to the enum (reported by
umnitus on #7163). The handler now reads each argument's Type field as a
uint32_t through memcpy and compares it with 105; the test writes and reads
the raw value the same way, and the mock records it the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 084c8c60e7)
The Vulkan layer created signatures for draw, draw-indexed and dispatch only and answered E_NOTIMPL
for DISPATCH_MESH, which the PC runtime creates on any mesh-shader tier 1 device. A title that
creates such a signature at startup and asserts on the result stopped there.

The signature is created when the device has VK_EXT_mesh_shader (MeshShaderTier 1), as a new
IndirectKind::dispatch_mesh (the name and value #3777 uses, so the two merge). ExecuteIndirect with
it records nothing yet and says so once; #3777 replays it as vkCmdDrawMeshTasksIndirectEXT.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit efc347830b)
Resolving the cherry-pick of efc347830 I dropped main's record-size, stride and span checks (e1ec785b2), which
d3d12_execute_indirect_validation_test depends on and which matter to every D3D12 user (found in review on
#377). They are back as on main, the record-size chain knows D3D12_DISPATCH_MESH_ARGUMENTS, and the early
return for a DISPATCH_MESH signature comes after the checks.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title calls device slot 61 as CreateSamplerX(desc, dest handle), once
per sampler, after its descriptor heaps exist (stop 20 of the RT-5 boot
measurements in the coordination issue). The generic thunk forwarded it to the
PC slot 61, which is CreateMetaCommand, so the sampler was never written.

Slot 61 now has its own handler, like 62 and 67. It passes the description's
PC D3D12_SAMPLER_DESC prefix and the handle to the PC CreateSampler (slot 22).
That was enough to get the title past this call under Wine. Whatever follows
the prefix in the console description is not known and is not read. A null
description is skipped and logged once. A handle in the title's own heap range
is #7021's translation.

xs_proxy_mock_test: slot 61 reaches the mock's slot 22 with the same two words
and never its slot 61; a null description reaches nothing. With main's
d3d12_xs_device.cpp the new check fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e22994464b)
The proxy also serves host callers: d3d12_vulkan_device_test drives the Vulkan device through it,
and its ID3D12Device5::CreateMetaCommand call (PC slot 61) landed in proxy_create_sampler_x
(found by nullmarsh on #7115: the test stopped at line 5763 instead of main's known line 6574).

Slot 61 now checks the caller's return address with a classifier the runtime installs
(set_console_caller, the name #7490 uses): D3D12XboxCreateDevice installs
rt::shims::mapped_image_base, so only a caller in an image the guest loader mapped gets
CreateSamplerX. Any other caller, and every caller when no classifier is installed, is forwarded
to the PC slot 61.

xs_proxy_mock_test checks all three cases: no classifier (PC slot 61), a guest caller (PC
CreateSampler with the same words; a null description skipped) and a host caller under an
installed classifier (PC slot 61). d3d12_vulkan_device_test again stops at line 6574, as on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 8f756ebe048af042638ce51a61490f35f4f44ee3)
(cherry picked from commit c915e1da45)
Slot 61 passed the destination handle to the PC CreateSampler as given. With the title's descriptor range
honoured (__XMemAllocationHooks__), a handle in that range has to be translated to the real heap's, as device
slots 17 to 24 do (asked for in review on #377).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title calls slot 74 once; the PC slot 74 reads the first pointer as kinds and returns E_INVALIDARG, so the title hits an int3. The proxy handler does not call the PC device, writes nothing, logs the three words once, and yields to an env slot override that moves a route onto 74.

(cherry picked from commit cdeee35aa8)

Adapted to main by Mumogg: the queue route inside route_xbox_device_slot calls proxy_create_command_queue_xbox
(the 32-byte description of 0cde63d61), as the inline route did before this commit moved the routes into a
function.
The stand-in also took a host's ID3D12Device9::ShaderCacheControl call through the proxy and answered S_OK
without reaching the device (found on native Windows by BadgersMC in the review of this change). Slot 74 now
asks the caller classifier slot 61 uses (set_console_caller): a caller in an image the guest loader mapped gets
the stand-in, any other caller, and every caller when no classifier is installed, is forwarded to the PC slot 74
or refused past the PC device's table.

xs_proxy_mock_test: the guest case under a classifier, and the host case with a classifier and with none, on a
device that has ShaderCacheControl and on one that does not.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Asked for in review on #377.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
(cherry picked from commit e925b63455)

Adapted to main by Mumogg: main has command-list proxies, so the shared execute function replaces them by their
real lists in a copy of the array (UnwrappedArray), for the console slot 35 as for the PC slot 10, whose test
failed otherwise. The slot 35 mock case passes two mock lists instead of two numbers and checks that they arrive
and that the caller's array is not written.
(cherry picked from commit e29e989980)
Asked for in review on #377.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title resets its command lists through list slot 139, with (allocator proxy, pipeline state). main's
slot map had no entry for it, so the call was recorded and dropped and the list stayed closed. The map sends it
to the PC slot 10, and the unwrap keys on the PC slot, so console slot 10 and console slot 139 both hand the real
list its real allocator (and a wrapped pipeline state the same way) and re-pin the inline cursor.

The mapping and the unwrap rule are those of ef9d0759d (Nolan Cotter; measured by Pipodi), written again for
main's list proxy, where that commit does not apply. xs_proxy_mock_test checks the map entry and a slot 139 call.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Queue slot 18 is ID3D12CommandQueue::GetDesc on the PC: a struct return that writes a 16-byte description through
the hidden pointer. The retail title calls slot 18 with one pointer to 8 bytes, the shape of
GetTimestampFrequency(UINT64*), which the console queue has there (two methods are inserted at 14/15, so the PC
slots 16 to 18 sit two later). Forwarded as GetDesc, the call wrote a description over the title's 8 bytes and
what follows them; the title then went wrong a little later, after its first submission.

The title's call (set_console_caller, as device slots 61 and 74) now goes to the PC slot 16. A host caller, and
every caller when no classifier is installed, keeps the PC GetDesc.

The reading of slot 18 is that of the console queue work in old PR 2490 (Nolan Cotter), which answers an
undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That
work's layout detection does not apply to main's queue proxy; this is the one rule the boot needs, written for
it. xs_proxy_mock_test: the guest call reaches the mock queue's slot 16 with its pointer and leaves the words
around it; a host call, with a classifier and with none, reaches slot 18.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title presents through command-queue slot 32, past the PC queue's 19 slots, so main refused it with
E_NOTIMPL and nothing could be shown. The slot now calls XboxPresentation::PresentX (xbox_present.h) with the
title's plane count, planes and parameters. The first call on a device builds a window and the Vulkan layer's
presenter for it, once; a device that cannot present answers S_OK and shows nothing, so the title's frame loop
runs either way. The mock and COM builds of this file have no presenter and answer S_OK.

The wiring follows old PR 2490's (Nolan Cotter, 2be25cee2), written again for main's queue proxy, where that
commit does not apply. Not carried over: the queue layout detection (the older layout has PresentX at slot 30)
and presenting into the title's own window (old PR 8591); the window here is one this layer creates.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Device slot 80 (WaitFrameEventX, from #6935) numbered its tokens with a
counter of its own, while XboxPresentation's pacer refuses any token above
the ones it issued itself. A title that waits through the device and
presents through the device's XboxPresentation therefore had every
PresentX refused with E_INVALIDARG once its tokens ran ahead of the
pacer's.

leonida::FrameTokenSource is now the counter both use: a pacer takes an
optional shared source (a standalone pacer still owns its own and numbers
as before), the device proxy owns one and exposes it through
rt::d3d12_xs::device_frame_tokens, and XboxPresentation passes a given
source to its pacer. A token that was never issued is still refused.

Reported by rafaelpssz in #7496.

(cherry picked from commit afb14d56c6)

Adapted to main by Mumogg: main's uncapped pacer path issues its token from the shared source too, the device
proxy keeps the PresentX state next to the token source, and the queue's PresentX hands the device's source to
its XboxPresentation, which is what makes the title's tokens valid there.
The coverage gate asks for every queue slot to have been called, and skips the overridden ones in its sweep of
the refused tail. Slot 32 is overridden since the PresentX wiring, so nothing called it and the gate failed
("queue slot 32 never called"). The test now calls it where it calls the console ExecuteCommandLists slot: this
build of the proxy has no presenter, so the answer is S_OK.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Device slots 17 to 24 translate a CPU descriptor handle in the title's own range (__XMemAllocationHooks__) to
the real heap's. The five command-list methods that take such handles did not: OMSetRenderTargets (console slot
50), ClearDepthStencilView (51), ClearRenderTargetView (52) and the two ClearUnorderedAccessView (53, 54) went
to the real list with the title's address, which is no descriptor there. On the retail boot the first
ClearRenderTargetView made the list's Close fail.

They translate now, in copies: the caller's arrays are not written, and a handle outside the range is passed as
it is. Slot 51 gets a typed thunk, because its depth is a FLOAT in XMM3, which the all-integer list thunk loses.

This is 0aba6c361 (LeonidaBringup) written again for main's list proxy, where that commit does not apply (it
sits on old PR 2490's list proxy). xs_proxy_mock_test: the five slots with a handle inside the range, one
outside it, and the caller's arrays unchanged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The console allows ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS on a texture; the PC runtime refuses the pair and
slot 25 answered UINT64_MAX for it. pc_resource_flags drops the UAV bit from depth-stencil textures (slot 25 through
pc_resource_desc, and slot 76). Their UAV views then write no descriptor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 4a86034367)

Adapted to main by Mumogg: the conflict is with b4d1ba179, which is applied before it here: slot 25 keeps that
commit's scoped cleaning, and this one adds the flag rule and its log line.
A console depth-stencil texture may also allow unordered access, which the PC runtime refuses. Slots 25 and 76 already create such a texture as a depth-stencil texture alone; slots 127 (CreateCommittedResource3) and 133 (CreatePlacedResourceX) masked only the Xbox flag bits and kept the pair.

Slot 127 now takes its PC flags from pc_resource_flags, and slot 133 drops the flag on a depth-stencil texture with without_depth_stencil_uav. Buffers, render targets and plain depth-stencil textures keep their flags. The mock tests cover both slots.
The retail boot's stop after #517 is slot 127 asking for a TEXTURE3D
768x768x6 R16_TYPELESS depth-stencil, one mip, one sample,
ALLOW_DEPTH_STENCIL. PC D3D12 has no volume depth-stencil: the layer's
GetResourceAllocationInfo answers UINT64_MAX and CreateCommittedResource3
refuses it.

On #427's d3d12_xs_desc_clean.h (this commit sits on #772, which contains
#427), add the measured shape and its translation: TEXTURE3D,
ALLOW_DEPTH_STENCIL, MipLevels 1, SampleDesc.Count 1, DepthOrArraySize 6
becomes TEXTURE2D with the same six slices. Slot 25's existing descriptor
copy applies it before sizing; slots 76 and 127 and the slot 133 handler
apply it before creating. The format, the depth-stencil flag, the clear
value and the counts are the title's and are left alone; the caller's
description is never written.

A multi-mip volume, another slice count or a multisampled one is not
translated: a 3D mip shrinks its depth while a 2D array keeps every layer
at every mip. Those stay as they came and the PC refusal stands. The
global PC rule is unchanged.

xs_proxy_mock_test covers the measured descriptor through sizing, both
committed-resource slots and the placed handler, asserts the caller's
descriptor is byte-identical after every call, and checks that a
four-slice, multi-mip or colour volume keeps its dimension.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:38 +00:00
github-bot closed this pull request 2026-11-26 09:30:39 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 15:52 UTC · original · reviewed

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.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-24 15:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/961#pullrequestreview-6042660689) · **reviewed** 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.
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-24 19:05 UTC · original

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.

**@⁠bobcatchris** on GitHub · 2026-11-24 19:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/961#issuecomment-7141588223) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.