upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/d3d12_command_objects.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/d3d12_command_objects.md')
-rw-r--r--docs/d3d12_command_objects.md33
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
427it writes the command into that buffer itself instead of calling: a root argument is a header word from the 427it writes the command into that buffer itself instead of calling: a root argument is a header word from the
428per-root-parameter table at `+0x344` and then the value (32 bits for a descriptor table, 64 for the slot-41 GPU VA), 428per-root-parameter table at `+0x344` and then the value (32 bits for a descriptor table, 64 for the slot-41 GPU VA),
429a dispatch four words (`0x4002c400`, or `(flag | 0x1000ba00) << 2`, then x, y, z). 429a dispatch four words (`0x4002c400`, or `(flag | 0x1000ba00) << 2`, then x, y, z).
430The BVH builder also writes a five-word dispatch, `0x4003cc00, x, 1, 1, W`. 430It sets a flag byte at `+0x140`, stores a flag at `+0x141` from the
431pipeline, and copies 32 bytes of the pipeline object (from its `+0x10`) to `+0x544`. These are the fields
432section 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
434them, and it is the simplest contract for a layer that does not want to decode these packets. Whether the game's
435executable makes the same check before writing is unknown until it is available; it is compiled against the same
436console 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
438The FSR DLL never writes this form. 448The 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
440byte ptr [reg+143h]`), but neither DLL writes it. Every store into `+0x140`..`+0x143` in either DLL is a byte store to 451byte 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
443only for root constants: 455only 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
452No site combines both adjustments. Before writing, every reader tests the entry against `0xC0000000` (98 sites in the 464No site combines both adjustments. Before writing, every reader tests the entry against `0xC0000000` (98 sites in the
453builder, 7 in the FSR DLL), and sets the flag byte at `+0x140` only when both of those bits are clear. 465builder, 7 in the FSR DLL), and sets the flag byte at `+0x140` only when both of those bits are clear.
454It sets a flag byte at `+0x140`, stores a flag at `+0x141` from the
455pipeline, and copies 32 bytes of the pipeline object (from its `+0x10`) to `+0x544`. These are the fields
456section 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
458them, and it is the simplest contract for a layer that does not want to decode these packets. Whether the game's
459executable makes the same check before writing is unknown until it is available; it is compiled against the same
460console headers.
461 466
462### 3.5 What the package does not measure 467### 3.5 What the package does not measure
463 468