diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 14:37:20 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 14:37:20 -0500 |
| commit | 721a3b85aedebb52b00b6a34cc269ee72d62b8b6 (patch) | |
| tree | 39f9295e2b46c4d2abd32181eef242c069b938c2 /docs/d3d12_command_objects.md | |
| parent | 5668f16b490a182452521fca3ccfc29e682eca2b (diff) | |
| parent | e18b59a5b77a8400f66b71b5f12d713bb12c63e0 (diff) | |
Merge main into wave64-partial-wave-zero
Conflict in scripts/run_gpu_tests.py: the dump-test name list gained
cs_w64x_cmp_sdst on main and cs_w64x_partial_swizzle here; both are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/d3d12_command_objects.md')
| -rw-r--r-- | docs/d3d12_command_objects.md | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md index 5a214e325..36a02e874 100644 --- a/docs/d3d12_command_objects.md +++ b/docs/d3d12_command_objects.md | |||
| @@ -375,9 +375,10 @@ section 3.5a), and the console list has methods well past the PC tail: 71, 73, 8 | |||
| 375 | FSR DLL. | 375 | FSR DLL. |
| 376 | 376 | ||
| 377 | Slot 148 matters beyond the builder: the address it returns is written by the CPU and passed unchanged to the GPU | 377 | Slot 148 matters beyond the builder: the address it returns is written by the CPU and passed unchanged to the GPU |
| 378 | as a root SRV address, so console upload memory has the same address for the CPU and the GPU. A replacement must | 378 | as a root SRV address, so console upload memory has the same address for the CPU and the GPU. On a PC the two |
| 379 | return memory whose CPU pointer is also a valid GPU address (for this layer: inside the arena of | 379 | address spaces differ, so `d3d12_xs_device.cpp` carves a bump arena out of persistently-mapped UPLOAD-heap |
| 380 | [d3d12_vulkan.md §3.3](d3d12_vulkan.md)). | 380 | buffers: the title writes the mapped memory and the six root descriptor setters and the IA/SO view setters |
| 381 | translate the CPU pointer to the chunk's buffer device address before forwarding. | ||
| 381 | 382 | ||
| 382 | The function at `0xd580` uses the 71/73 pair instead of the slot-146 barrier when the byte at RVA `0xd773c` is set. | 383 | The function at `0xd580` uses the 71/73 pair instead of the slot-146 barrier when the byte at RVA `0xd773c` is set. |
| 383 | That byte is one of seven bools at `0xd7738`–`0xd773e` in zero-initialised `.bss`. The only accesses to them in | 384 | That byte is one of seven bools at `0xd7738`–`0xd773e` in zero-initialised `.bss`. The only accesses to them in |
| @@ -564,6 +565,10 @@ shape and the shift around them, but the shape alone does not single the method | |||
| 564 | | 55 (`+0x1b8`) | **51** | `DiscardResource` | `(resource, null)` at `0x6dcb`, after the pending barriers are flushed through slot 26 | | 565 | | 55 (`+0x1b8`) | **51** | `DiscardResource` | `(resource, null)` at `0x6dcb`, after the pending barriers are flushed through slot 26 | |
| 565 | | 59 (`+0x1d8`) | — | console only (shape) | four calls, two shapes: `(1, blob, size)` at `0x6b5a` and `0x6d53`, the blob a run of qwords whose first is `0xf3080 \| (qword count & 0x7f)`; and `(0, &qword, 8)` with the qword 1 at `0x6e52` and `0x6eb8`, only when a profiling bit of the context is set (`0x6e2a`). The first argument is set as a byte (`mov dl, 1` / `xor edx, edx`). It looks like one slot for both ends of a GPU event; no public method takes a bool first. With 55 at +4 and 61 at +2, the two slots the console lacks are among 56–60 | | 566 | | 59 (`+0x1d8`) | — | console only (shape) | four calls, two shapes: `(1, blob, size)` at `0x6b5a` and `0x6d53`, the blob a run of qwords whose first is `0xf3080 \| (qword count & 0x7f)`; and `(0, &qword, 8)` with the qword 1 at `0x6e52` and `0x6eb8`, only when a profiling bit of the context is set (`0x6e2a`). The first argument is set as a byte (`mov dl, 1` / `xor edx, edx`). It looks like one slot for both ends of a GPU event; no public method takes a bool first. With 55 at +4 and 61 at +2, the two slots the console lacks are among 56–60 | |
| 566 | | 61 (`+0x1e8`) | **59** | `ExecuteIndirect` | `(signature, 1, argument buffer, offset, null, 0)` at `0x59a0` | | 567 | | 61 (`+0x1e8`) | **59** | `ExecuteIndirect` | `(signature, 1, argument buffer, offset, null, 0)` at `0x59a0` | |
| 568 | | 71 (`+0x238`) | — | console only | `Write32BitValueBottomOfPipeX(address, u32 value, flush, flags)`: the 32-bit value, written into the title's memory once the list's work has run (the list values, [d3d12_xs_console_abi.md §5.5](d3d12_xs_console_abi.md)) | | ||
| 569 | | 72 (`+0x240`) | — | console only | `Write64BitValueBottomOfPipeX(address, u64 value, flush, flags)`: the 64-bit value; flags 1 ask for a GPU timestamp and 2 for a system timestamp instead of the value the call carried | | ||
| 570 | | 73 (`+0x248`) | — | console only | `Wait32BitValueX`: a wait on the 32-bit value; the list values hold the queue until it compares true or times out (§5.5 there) | | ||
| 571 | | 74 (`+0x250`) | — | console only | `Wait64BitValueX`: the same on the 64-bit value | | ||
| 567 | | 85 (`+0x2a8`) | — | `CopyTextureRegion` shape (inferred) | run: `(stack pointer, 0, 0)`, twice per dispatch. Statically six arguments, `(&dst, 0, 0, 0, &src, null)`: the public `CopyTextureRegion` (PC 16) with two `D3D12_TEXTURE_COPY_LOCATION`s, not one pointer. At `0x7147` dst is `{texture, SUBRESOURCE_INDEX, 0}` and src `{buffer, PLACED_FOOTPRINT, footprint}`, the footprint from device slot 38 (`GetCopyableFootprints`, `0x708b`); at `0x7191` both are subresource 0 (texture to texture). The caller also clears the next stack argument (`0x70e7`); whether the method takes a seventh is open, as is what console slot 16 is | | 572 | | 85 (`+0x2a8`) | — | `CopyTextureRegion` shape (inferred) | run: `(stack pointer, 0, 0)`, twice per dispatch. Statically six arguments, `(&dst, 0, 0, 0, &src, null)`: the public `CopyTextureRegion` (PC 16) with two `D3D12_TEXTURE_COPY_LOCATION`s, not one pointer. At `0x7147` dst is `{texture, SUBRESOURCE_INDEX, 0}` and src `{buffer, PLACED_FOOTPRINT, footprint}`, the footprint from device slot 38 (`GetCopyableFootprints`, `0x708b`); at `0x7191` both are subresource 0 (texture to texture). The caller also clears the next stack argument (`0x70e7`); whether the method takes a seventh is open, as is what console slot 16 is | |
| 568 | | 141 (`+0x468`) | — | console only | `(2, GPU VA, size, n)` at `0x65f8`: binds a buffer the DLL names `FFX_XBox_ComputeScratch`; `n` is the bound pipeline's scratch value from pipeline slot 11 (see above) | | 573 | | 141 (`+0x468`) | — | console only | `(2, GPU VA, size, n)` at `0x65f8`: binds a buffer the DLL names `FFX_XBox_ComputeScratch`; `n` is the bound pipeline's scratch value from pipeline slot 11 (see above) | |
| 569 | 574 | ||
| @@ -572,6 +577,20 @@ So the console list has four more methods than the PC list between `ResourceBarr | |||
| 572 | Mapping the console list as "PC plus a constant" is wrong. The BVH builder adds 37, 39, 43 and 45 (the rest of the | 577 | Mapping the console list as "PC plus a constant" is wrong. The BVH builder adds 37, 39, 43 and 45 (the rest of the |
| 573 | +4 root group) and the console-only 71, 73, 80, 146 (`Barrier`) and 148 (sections 3.3 and 3.3a). | 578 | +4 root group) and the console-only 71, 73, 80, 146 (`Barrier`) and 148 (sections 3.3 and 3.3a). |
| 574 | 579 | ||
| 580 | **The two value-write slots.** Slots 71 and 72 are the console's value writes and 73 and 74 the waits that go with | ||
| 581 | them. The slot numbers are measured, not read: the retail title's own trace calls slot 71 with a title address and | ||
| 582 | a value, slot 72 with a title address and the flags word and slot 74 with a wait's arguments, and the value writes | ||
| 583 | are at 71/72 rather than at 69/70; and `XboxBvhBuilder.dll` reads a 32-bit value write at `+0x238` (slot 71) and a masked wait at `+0x248` | ||
| 584 | (slot 73). The call shapes are xcl's (crates/xcl/src/hle/d3d12x/list_x.rs, GPL-2.0) and the deferred | ||
| 585 | bottom-of-pipe write model is VIctory's (crates/victory-gpu/src/list.rs, GPL-3.0): the write is not a GPU command, | ||
| 586 | it is a CPU write into the title's memory, made after the submission that recorded it has run. Both projects are | ||
| 587 | cited for facts and for the model only, no code copied. The runtime has two writers for them, one per list: the list | ||
| 588 | values (`runtime/shims/d3d12_xs_list_values.h`, on by default) for the lists they track, with the waits of slots 73 | ||
| 589 | and 74; and the GPU-label path (`runtime/src/vulkan_gpu_labels.h`, `LEONIDA_GPU_LABELS=1`) for the others. Both | ||
| 590 | land a write whose address is a GPU address arena offset in the arena, never at that number in host memory, and one | ||
| 591 | on a page of xmem's that the title's view keeps `PAGE_NOACCESS` through xmem's own mapping of the physical page | ||
| 592 | (`runtime/src/value_write_sink.h`). | ||
| 593 | |||
| 575 | **The list object is wider than its vtable, and this is what that width is for.** Before a root-argument or dispatch | 594 | **The list object is wider than its vtable, and this is what that width is for.** Before a root-argument or dispatch |
| 576 | call the DLL checks a write cursor at `+0x18` against a limit (`+0x30` for root arguments, `+0x28` for a dispatch). While there is room, | 595 | call the DLL checks a write cursor at `+0x18` against a limit (`+0x30` for root arguments, `+0x28` for a dispatch). While there is room, |
| 577 | it writes the command into that buffer itself instead of calling: a root argument is a header word from the | 596 | it writes the command into that buffer itself instead of calling: a root argument is a header word from the |
| @@ -764,6 +783,12 @@ Queues and fences are wrapped the same way. | |||
| 764 | object implements but the proxy does not model is logged once and refused. | 783 | object implements but the proxy does not model is logged once and refused. |
| 765 | - **The refused tail.** A slot past the public chain, up to the end of the proxy's own table (128 queue and | 784 | - **The refused tail.** A slot past the public chain, up to the end of the proxy's own table (128 queue and |
| 766 | 64 fence slots, every one a thunk), logs its first four argument words once and returns `E_NOTIMPL`. | 785 | 64 fence slots, every one a thunk), logs its first four argument words once and returns `E_NOTIMPL`. |
| 786 | - **Fence slot 12.** The one served slot past the chain. The retail executable calls it as | ||
| 787 | `(value, descriptor, flags)` and reads the return as a pointer to the fence's 64-bit completed value: it | ||
| 788 | compares that value with `~0` (device removed) and subtracts the value it waits for. The proxy returns a | ||
| 789 | per-fence mirror. Completion events refresh it immediately. A 10 ms wait timeout also refreshes it if the | ||
| 790 | fence rewinds below the pending event's threshold. Slot 12 and the CPU `Signal` (10) refresh it synchronously. | ||
| 791 | The descriptor's second word is a code pointer, which is not called. | ||
| 767 | - **The guard region.** Each table sits at the end of the first page of a 64 KiB reservation, and the rest | 792 | - **The guard region.** Each table sits at the end of the first page of a 64 KiB reservation, and the rest |
| 768 | of that reservation is never committed. A slot past the table therefore faults on the vtable read itself, | 793 | of that reservation is never committed. A slot past the table therefore faults on the vtable read itself, |
| 769 | inside the reservation, and a vectored handler logs the slot before the fault goes on. A vtable read that | 794 | inside the reservation, and a vectored handler logs the slot before the fault goes on. A vtable read that |
| @@ -830,7 +855,7 @@ command object. | |||
| 830 | | Item | Why it is blocked | | 855 | | Item | Why it is blocked | |
| 831 | |---|---| | 856 | |---|---| |
| 832 | | `PresentX` | No slot, signature, plane struct or swapchain/plane parameters. Prior art gives only names, the 2-plane/8-view limits and four flag names. | | 857 | | `PresentX` | No slot, signature, plane struct or swapchain/plane parameters. Prior art gives only names, the 2-plane/8-view limits and four flag names. | |
| 833 | | `CreateCommandQueueX` | No slot or parameter layout; only the UMD message and an inferred shape. | | 858 | | `CreateCommandQueueX` | No slot or parameter layout; only the UMD message and an inferred shape. The retail title calls device slot 48 as (desc, riid, out) with a 32-byte desc (#6954), which differs from the (pDesc, pShaderQueueParams, riid, out) shape inferred above. | |
| 834 | | `SuspendX` / `ResumeX` | No slot or signature. | | 859 | | `SuspendX` / `ResumeX` | No slot or signature. | |
| 835 | | Xbox queue/list/fence/allocator slot deviations | No runtime binary and no game executable; the package has no queue, fence or allocator client, and its only command-list client is the BVH builder. | | 860 | | Xbox queue/list/fence/allocator slot deviations | No runtime binary and no game executable; the package has no queue, fence or allocator client, and its only command-list client is the BVH builder. | |
| 836 | | Builder's list field `+0x350` | Read once (`0x1d877`) and not explained by the inline buffer of section 3.5a, which covers `+0x18`, `+0x28`, `+0x30`, `+0x140`, `+0x141`, `+0x344` and `+0x544`. | | 861 | | Builder's list field `+0x350` | Read once (`0x1d877`) and not explained by the inline buffer of section 3.5a, which covers `+0x18`, `+0x28`, `+0x30`, `+0x140`, `+0x141`, `+0x344` and `+0x544`. | |