diff options
| author | CLHelper <359823989+CLHelper@users.noreply.github.com> | 2026-11-22 16:33:44 +0000 |
|---|---|---|
| committer | CLHelper <359823989+CLHelper@users.noreply.github.com> | 2026-11-22 16:33:44 +0000 |
| commit | 507ab37e19e60bca7d0090f1e4fd3d3ec2e324ae (patch) | |
| tree | 015a47da0654d8c04a493cd467065b72959acc3b /docs/d3d12_command_objects.md | |
| parent | 00a0f7f9935a1b7f37eaf281314e188714687cb4 (diff) | |
docs: address review of the inline-dispatch notes
- move the new notes after the list-setup paragraph instead of splitting it
- list the fourth slot-80 fallback (0x1d047, W = 0x8020) in the section 3.3a row and the bullets
- write the header as table[root] + ((count - 1) << 16)
- say what is read from the code (the slot-80 fallback) and what stays inferred (slot 80's meaning)
Diffstat (limited to 'docs/d3d12_command_objects.md')
| -rw-r--r-- | docs/d3d12_command_objects.md | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md index 12800a434..0851f0cb3 100644 --- a/docs/d3d12_command_objects.md +++ b/docs/d3d12_command_objects.md | |||
| @@ -303,7 +303,7 @@ of an inline write of the same values. | |||
| 303 | | `0x1a3b0` | `+0x168` | 45 → 41 `SetComputeRootUnorderedAccessView` | `(0, VA)` (inline: header + a 64-bit value) | **Measured** shape | | 303 | | `0x1a3b0` | `+0x168` | 45 → 41 `SetComputeRootUnorderedAccessView` | `(0, VA)` (inline: header + a 64-bit value) | **Measured** shape | |
| 304 | | `0x20ed6` | `+0x4a0` | 148 → none | `(list, count * 40, 16)` returns a pointer; on null the DLL prints `D3D12 XDXR Error: Failed to allocate upload buffer` and throws `E_FAIL` | **Measured**: an upload allocator `(size, alignment)` | | 304 | | `0x20ed6` | `+0x4a0` | 148 → none | `(list, count * 40, 16)` returns a pointer; on null the DLL prints `D3D12 XDXR Error: Failed to allocate upload buffer` and throws `E_FAIL` | **Measured**: an upload allocator `(size, alignment)` | |
| 305 | | `0x20f99` | `+0x158` | 43 → 39 `SetComputeRootShaderResourceView` | `(0, p)`, `p` the pointer slot 148 returned at `0x20ed6`, unchanged | **Measured**: the CPU pointer is used as the GPU address | | 305 | | `0x20f99` | `+0x158` | 43 → 39 `SetComputeRootShaderResourceView` | `(0, p)`, `p` the pointer slot 148 returned at `0x20ed6`, unchanged | **Measured**: the CPU pointer is used as the GPU address | |
| 306 | | `0x149ba` | `+0x280` | 80 → none | `(x, 1, 1, 0x8020)`: `EDX=EDI`, `R8D=R9D=1`, fifth argument `0x8020` (inline: the five-dword packet `0x4003cc00, x, 1, 1, W` of section 3.5a; the calls at `0x1525d` and `0x153b4` pass `0x20`) | Inferred: a `Dispatch` with one extra word | | 306 | | `0x149ba` | `+0x280` | 80 → none | `(x, 1, 1, 0x8020)`: `EDX=EDI`, `R8D=R9D=1`, fifth argument `0x8020` (inline: the five-dword packet `0x4003cc00, x, 1, 1, W` of section 3.5a; the calls at `0x1525d` and `0x153b4` pass `0x20`, the one at `0x1d047` `0x8020`) | Inferred: a `Dispatch` with one extra word | |
| 307 | | `0xd6de` | `+0x238` | 71 → none | `(&label, counter, 0 or 0x1000, 0)`: the counter at `[rbx+0x9c]` is incremented first; `0x1000` on the last item of a batch | Inferred: a GPU write of a 32-bit value to memory | | 307 | | `0xd6de` | `+0x238` | 71 → none | `(&label, counter, 0 or 0x1000, 0)`: the counter at `[rbx+0x9c]` is incremented first; `0x1000` on the last item of a batch | Inferred: a GPU write of a 32-bit value to memory | |
| 308 | | `0xd679` | `+0x248` | 73 → none | `(&label, 3, reference, 0xffffffff, 0)` | Inferred: a GPU wait until the masked value compares (function 3) with the reference | | 308 | | `0xd679` | `+0x248` | 73 → none | `(&label, 3, reference, 0xffffffff, 0)` | Inferred: a GPU wait until the masked value compares (function 3) with the reference | |
| 309 | | `0xd7b4` | `+0x490` | 146 → GCL7 80 `Barrier` | the same global UAV barrier as `0x1da02` | **Measured** | | 309 | | `0xd7b4` | `+0x490` | 146 → GCL7 80 `Barrier` | the same global UAV barrier as `0x1da02` | **Measured** | |
| @@ -427,22 +427,34 @@ call the DLL checks a write cursor at `+0x18` against a limit (`+0x30` for root | |||
| 427 | it writes the command into that buffer itself instead of calling: a root argument is a header word from the | 427 | it writes the command into that buffer itself instead of calling: a root argument is a header word from the |
| 428 | per-root-parameter table at `+0x344` and then the value (32 bits for a descriptor table, 64 for the slot-41 GPU VA), | 428 | per-root-parameter table at `+0x344` and then the value (32 bits for a descriptor table, 64 for the slot-41 GPU VA), |
| 429 | a dispatch four words (`0x4002c400`, or `(flag | 0x1000ba00) << 2`, then x, y, z). | 429 | a dispatch four words (`0x4002c400`, or `(flag | 0x1000ba00) << 2`, then x, y, z). |
| 430 | The BVH builder also writes a five-word dispatch, `0x4003cc00, x, 1, 1, W`. | 430 | It sets a flag byte at `+0x140`, stores a flag at `+0x141` from the |
| 431 | pipeline, and copies 32 bytes of the pipeline object (from its `+0x10`) to `+0x544`. These are the fields | ||
| 432 | section 3.4 measured in the BVH builder's helper without a meaning (`+0x18`, `+0x30`, `+0x140`, `+0x344`, `+0x544`). | ||
| 433 | **With the cursor at the limit, every command goes through the vtable**: that is how `fsr_dispatch_test` records | ||
| 434 | them, and it is the simplest contract for a layer that does not want to decode these packets. Whether the game's | ||
| 435 | executable makes the same check before writing is unknown until it is available; it is compiled against the same | ||
| 436 | console headers. | ||
| 437 | |||
| 438 | **The five-word dispatch.** The BVH builder also writes `0x4003cc00, x, 1, 1, W`: | ||
| 439 | |||
| 431 | - **Sites:** `0x14972`, `0x15215`, `0x1536a` and `0x1d002`, each checked against the dispatch limit `+0x28`. The | 440 | - **Sites:** `0x14972`, `0x15215`, `0x1536a` and `0x1d002`, each checked against the dispatch limit `+0x28`. The |
| 432 | cursor advances 20 bytes and the flag byte at `+0x140` is cleared. | 441 | cursor advances 20 bytes and the flag byte at `+0x140` is cleared. |
| 433 | - **It is the inline form of console slot 80** (section 3.3a). When the buffer is full, each site calls slot 80 | 442 | - **Its vtable fallback is console slot 80** (section 3.3a), read from the code: when the buffer is full, each site |
| 434 | (`+0x280`) instead, as `(x, 1, 1, W)` with the same `W`. | 443 | calls slot 80 (`+0x280`) instead, as `(x, 1, 1, W)` with the same `W` (`0x149ba`, `0x1525d`, `0x153b4`, `0x1d047`). |
| 435 | - **`W` is `0x8020`** at `0x14972` and `0x1d002`, and **`0x20`** at `0x15215` and `0x1536a`. What bit 15 selects is | 444 | So the packet is slot 80's inline form; that slot 80 is a `Dispatch` with one extra word stays inferred. |
| 436 | open. | 445 | - **`W` is `0x8020`** at `0x14972` and `0x1d002`, and **`0x20`** at `0x15215` and `0x1536a`. What bit 15 of `W` |
| 446 | selects is not known. | ||
| 437 | 447 | ||
| 438 | The FSR DLL never writes this form. | 448 | The FSR DLL never writes this form. |
| 449 | |||
| 439 | **Byte `+0x143` is console-runtime state:** the BVH builder reads it at 31 sites and the FSR DLL at one (all `cmp | 450 | **Byte `+0x143` is console-runtime state:** the BVH builder reads it at 31 sites and the FSR DLL at one (all `cmp |
| 440 | byte ptr [reg+143h]`), but neither DLL writes it. Every store into `+0x140`..`+0x143` in either DLL is a byte store to | 451 | byte ptr [reg+143h]`), but neither DLL writes it. Every store into `+0x140`..`+0x143` in either DLL is a byte store to |
| 441 | `+0x140` or `+0x141`, and no wider store reaches `+0x143`. A replacement list can leave it 0. | 452 | `+0x140` or `+0x141`, and no wider store reaches `+0x143`. A replacement list can leave it 0. |
| 453 | |||
| 442 | **The root-argument header word** is the root parameter's table entry `table[root]` (`+0x344 + 4·root`), adjusted | 454 | **The root-argument header word** is the root parameter's table entry `table[root]` (`+0x344 + 4·root`), adjusted |
| 443 | only for root constants: | 455 | only for root constants: |
| 444 | 456 | ||
| 445 | - **Several 32-bit constants at once:** `table[root] + (count − 1) << 16`, then `count` dwords. Examples: | 457 | - **Several 32-bit constants at once:** `table[root] + ((count − 1) << 16)`, then `count` dwords. Examples: |
| 446 | `+ 0x120000` for 19 constants (`0x14e3b`), `+ 0x70000` for 8 (`0x1d324`), `+ 0x30000` for 4. | 458 | `+ 0x120000` for 19 constants (`0x14e3b`), `+ 0x70000` for 8 (`0x1d324`), `+ 0x30000` for 4. |
| 447 | - **One constant at a non-zero offset:** `table[root] + 4 · destOffset`. At `0x19fca` the builder adds `0xc` and its | 459 | - **One constant at a non-zero offset:** `table[root] + 4 · destOffset`. At `0x19fca` the builder adds `0xc` and its |
| 448 | vtable fallback is slot 37 `(2, value, 3)`; at `0x1a346` it adds `0x14` and the fallback is `(2, value, 5)`. | 460 | vtable fallback is slot 37 `(2, value, 3)`; at `0x1a346` it adds `0x14` and the fallback is `(2, value, 5)`. |
| @@ -451,13 +463,6 @@ only for root constants: | |||
| 451 | 463 | ||
| 452 | No site combines both adjustments. Before writing, every reader tests the entry against `0xC0000000` (98 sites in the | 464 | No site combines both adjustments. Before writing, every reader tests the entry against `0xC0000000` (98 sites in the |
| 453 | builder, 7 in the FSR DLL), and sets the flag byte at `+0x140` only when both of those bits are clear. | 465 | builder, 7 in the FSR DLL), and sets the flag byte at `+0x140` only when both of those bits are clear. |
| 454 | It sets a flag byte at `+0x140`, stores a flag at `+0x141` from the | ||
| 455 | pipeline, and copies 32 bytes of the pipeline object (from its `+0x10`) to `+0x544`. These are the fields | ||
| 456 | section 3.4 measured in the BVH builder's helper without a meaning (`+0x18`, `+0x30`, `+0x140`, `+0x344`, `+0x544`). | ||
| 457 | **With the cursor at the limit, every command goes through the vtable**: that is how `fsr_dispatch_test` records | ||
| 458 | them, and it is the simplest contract for a layer that does not want to decode these packets. Whether the game's | ||
| 459 | executable makes the same check before writing is unknown until it is available; it is compiled against the same | ||
| 460 | console headers. | ||
| 461 | 466 | ||
| 462 | ### 3.5 What the package does not measure | 467 | ### 3.5 What the package does not measure |
| 463 | 468 | ||