upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 17:26:34 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-22 17:26:34 -0500
commit34c130c36cebd482f5e40eddb0d3e76ad30607d7 (patch)
tree29721bafcb1f6d2ecf038fb9a993321166e14019 /docs
parentbcf3cd47f5de0eaab200c5daa4a40977a18e740a (diff)
docs: slot 67 passes the dispatch state on; what pipeline slot 11 does with 0, measured (RT-99)
- d3d12_command_objects.md section 3.5a: slot 67 now passes all four pairs; for slot 11, what the DLL does on failure and with 0 (measured in its code), the object's shape, why no program needs a scratch size (measured over the 29), what is implemented and what stays open. - fspx.md: the slot-67 payload and its checks, and slot 11. - d3d12_vulkan.md and runtime/README.md: the new parts of d3d12_fspx_compute_test; the DLL's own dispatch was not run here (fsr_dispatch_test needs MSVC structured exception handling). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/d3d12_command_objects.md24
-rw-r--r--docs/d3d12_vulkan.md19
-rw-r--r--docs/fspx.md18
3 files changed, 45 insertions, 16 deletions
diff --git a/docs/d3d12_command_objects.md b/docs/d3d12_command_objects.md
index 0c94f58c7..82ead294c 100644
--- a/docs/d3d12_command_objects.md
+++ b/docs/d3d12_command_objects.md
@@ -466,9 +466,10 @@ vtable pointer of a public object.
466 at `+0x18`, a copy of the kind-6 program at `+0x28` with its exact size at `+0x30`, and kind 7 at `+0x38` 466 at `+0x18`, a copy of the kind-6 program at `+0x28` with its exact size at `+0x30`, and kind 7 at `+0x38`
467 ([fspx.md](fspx.md)). The proxy maps the console desc to `D3D12_COMPUTE_PIPELINE_STATE_DESC` and routes it to 467 ([fspx.md](fspx.md)). The proxy maps the console desc to `D3D12_COMPUTE_PIPELINE_STATE_DESC` and routes it to
468 `CreateComputePipelineState` (PC slot 11). On a PC device that call fails (`E_FAIL`) because the code is not a PC 468 `CreateComputePipelineState` (PC slot 11). On a PC device that call fails (`E_FAIL`) because the code is not a PC
469 shader, so the DLL falls back to slot 62; its message for that failure calls the fallback "NewBE". The Vulkan 469 shader, so the DLL falls back to slot 62; its message for that failure calls the fallback "NewBE". With kind 0 in
470 device takes the bare kind-6 program and finds its translated module by `fspx_code_sha256` ([fspx.md](fspx.md), 470 the description (always, from this DLL) the proxy passes all four pairs on as one `FSPX` payload, checking each pair
471 "Build and run-time lookup"), for the programs the build translated. 471 before reading it. The Vulkan device then finds the translated module by `fspx_code_sha256` and `fspx_state_sha256`
472 ([fspx.md](fspx.md), "Build and run-time lookup"), for the programs the build translated.
472- **Slot 62** (call at `0x5825`) takes the measured `(D3D12_COMPUTE_PIPELINE_STATE_DESC*, 0, 0, riid, out)`. The PC 473- **Slot 62** (call at `0x5825`) takes the measured `(D3D12_COMPUTE_PIPELINE_STATE_DESC*, 0, 0, riid, out)`. The PC
473 runtime refuses the DLL's code (`E_FAIL`): it is not a PC shader. The DLL's pipeline function then returns 474 runtime refuses the DLL's code (`E_FAIL`): it is not a PC shader. The DLL's pipeline function then returns
474 `0x8000000d` (`0x4b85`), but the dispatch goes on, records the null pipeline and faults (`0x65ff`), which is where a 475 `0x8000000d` (`0x4b85`), but the dispatch goes on, records the null pipeline and faults (`0x65ff`), which is where a
@@ -482,9 +483,20 @@ vtable pointer of a public object.
482 the largest value (`+0x10f8`). Before a dispatch whose pipeline has a non-zero value (`0x64d3`; zero skips the 483 the largest value (`+0x10f8`). Before a dispatch whose pipeline has a non-zero value (`0x64d3`; zero skips the
483 binding), the DLL creates the scratch buffer once, `largest * 0xd0` bytes rounded up to 64 KiB, through device 484 binding), the DLL creates the scratch buffer once, `largest * 0xd0` bytes rounded up to 64 KiB, through device
484 slot 27 in state `UNORDERED_ACCESS` (`0x65ab`), names it `FFX_XBox_ComputeScratch`, and binds it with list slot 485 slot 27 in state `UNORDERED_ACCESS` (`0x65ab`), names it `FFX_XBox_ComputeScratch`, and binds it with list slot
485 141 `(2, GPU VA, buffer size, this pipeline's value)` (`0x65f8`). Measured: the calls and the arithmetic. Open: 486 141 `(2, GPU VA, buffer size, this pipeline's value)` (`0x65f8`). Measured: the calls and the arithmetic.
486 what the slot-11 object is, the unit of its dword (the factor 1024 suggests KiB), the meaning of `0xd0`, and 487 - **Failure and zero (measured, `0x585c` to `0x58b1`).** The value at `+0x44` is set to 0 before the call. A failed
487 of the leading `2`. 488 HRESULT or a null `obj` skips to the function's success return with the value still 0, so pipeline creation does
489 not depend on slot 11. At dispatch a value of 0 skips both the scratch buffer and list slot 141 (`0x64d6`).
490 - **The object (measured shape, hypothesis about its type).** Slot 3 is called with no arguments and its result is
491 read as a pointer to the dword; slot 2 releases it. That is the shape of `ID3DBlob::GetBufferPointer` and
492 `Release`.
493 - **No per-program size (measured on the 29 programs).** `COMPUTE_PGM_RSRC2.SCRATCH_EN` is clear in all 29, no
494 program has a `scratch_*` or `flat_scratch` instruction, and kind-0 words 0, 1 and 2 are each one value across
495 all 29.
496 - **Implemented.** The Vulkan device's pipeline answers slot 11 with a blob holding 0; console slots 9 and 10
497 return `E_NOTIMPL`. A translated module keeps its private data in SPIR-V, not in a console scratch buffer.
498 - **Open.** What the console returns there for these programs, the unit of the dword (the factor 1024 suggests
499 KiB), the meaning of `0xd0`, and of the leading `2`.
488- The DLL's 29 shaders are `DXBC` containers with `SFI0`, `ISG1`, `OSG1`, `PSV0`, `RTS0`, `HASH` and `ACCC` parts 500- The DLL's 29 shaders are `DXBC` containers with `SFI0`, `ISG1`, `OSG1`, `PSV0`, `RTS0`, `HASH` and `ACCC` parts
489 and no `DXIL`. The `ACCC` payload starts with the tag `FSPX` in all 29; the game's own native shaders are `FSSM` 501 and no `DXIL`. The `ACCC` payload starts with the tag `FSPX` in all 29; the game's own native shaders are `FSSM`
490 inside `XBCH` ([design.md](design.md)). `FSPX` is a directory around an uncompressed RDNA2 program and its 502 inside `XBCH` ([design.md](design.md)). `FSPX` is a directory around an uncompressed RDNA2 program and its
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 07db247b0..7778136c3 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -1105,7 +1105,13 @@ and any validation error fails them.
1105 `cs_user_data.comp`, which adds dword 1 of its code base: each must read its own kind-6 program. Ten inputs are 1105 `cs_user_data.comp`, which adds dword 1 of its code base: each must read its own kind-6 program. Ten inputs are
1106 refused with `E_INVALIDARG`: an untranslated program, bare and in a container; kind-6 entries that end past the 1106 refused with `E_INVALIDARG`: an untranslated program, bare and in a container; kind-6 entries that end past the
1107 payload, start inside the directory, wrap 32 bits, are too large or are empty; a container without `ACCC`; bytes 1107 payload, start inside the directory, wrap 32 bits, are too large or are empty; a container without `ACCC`; bytes
1108 without the prologue; and the program with four bytes appended. 1108 without the prologue; and the program with four bytes appended. It also covers the dispatch state:
1109 - one program in containers with three kind-0 entries picks its own entry for each, an unknown kind 0 is refused, and
1110 the bare program is refused as ambiguous;
1111 - slot 67 with all four pairs picks by kind 0 too (one entry's module is missing on purpose, so the pick shows as
1112 `E_FAIL`), and four inconsistent pairs are refused before they are read;
1113 - console slot 11 on a slot-67 and a slot-62 pipeline returns an object whose slot 3 points at the dword 0 and whose
1114 slot 4 gives 4 bytes; it releases to 0, and the pipeline's reference count is unchanged.
1109- `d3d12_set0_compute_test`: set 0 from the compute bind point, through the proxy and D3D12 alone. The index entry 1115- `d3d12_set0_compute_test`: set 0 from the compute bind point, through the proxy and D3D12 alone. The index entry
1110 of its shader lists set-0 bindings, so the PSO's layout holds the device's bindless set and replay binds it at 1116 of its shader lists set-0 bindings, so the PSO's layout holds the device's bindless set and replay binds it at
1111 each dispatch; nothing in the test binds it. Four dispatches of `test/glsl/cs_set0_sample.comp` (GLSL written to 1117 each dispatch; nothing in the test binds it. Four dispatches of `test/glsl/cs_set0_sample.comp` (GLSL written to
@@ -3476,11 +3482,12 @@ on a PC device behind the Xbox-ABI proxy). Measured:
3476 messages, not the PC method at that index; the proxy routes it to `CreateComputePipelineState`. The dispatch stops where the PC runtime 3482 messages, not the PC method at that index; the proxy routes it to `CreateComputePipelineState`. The dispatch stops where the PC runtime
3477 refuses the DLL's compute code at slot 62: the DLL's shaders carry an `ACCC` part instead of DXIL, an `FSPX` 3483 refuses the DLL's compute code at slot 62: the DLL's shaders carry an `ACCC` part instead of DXIL, an `FSPX`
3478 payload with an RDNA2 program ([fspx.md](fspx.md)). The Vulkan device takes both forms at 3484 payload with an RDNA2 program ([fspx.md](fspx.md)). The Vulkan device takes both forms at
3479 `CreateComputePipelineState`: the `ACCC` container slot 62 gets, and the bare kind-6 program the proxy forwards 3485 `CreateComputePipelineState`: the `ACCC` container slot 62 gets, and the `FSPX` payload the proxy builds from the
3480 from the slot-67 description (`+0x28`, size at `+0x30`). It finds the translated module by `fspx_code_sha256`, the 3486 slot-67 description's four pairs. It finds the translated module by `fspx_code_sha256` and `fspx_state_sha256` in
3481 SHA-256 of the kind-6 bytes, in `<shaders>/fspx/index.json`, which `make_game.py` writes ([fspx.md](fspx.md), 3487 `<shaders>/fspx/index.json`, which `make_game.py` writes ([fspx.md](fspx.md), "Build and run-time lookup";
3482 "Build and run-time lookup"; `d3d12_fspx_compute_test`). Not done: the console-only pipeline slot 11 the DLL 3488 `d3d12_fspx_compute_test`). The pipeline answers the console slot 11 the DLL calls afterwards with 0, so no
3483 calls afterwards. 3489 compute scratch buffer is made ([d3d12_command_objects.md](d3d12_command_objects.md) §3.5a). Not run here: the
3490 DLL's own dispatch on this device (`fsr_dispatch_test` needs MSVC structured exception handling).
3484 - Its `throw 1` reaches the caller. Before #965 the throw carried an image base of 0, because `_CxxThrowException` 3491 - Its `throw 1` reaches the caller. Before #965 the throw carried an image base of 0, because `_CxxThrowException`
3485 did not know manually mapped images; with #965 it carries the DLL's base, and the DLL still does not catch it on 3492 did not know manually mapped images; with #965 it carries the DLL's base, and the DLL still does not catch it on
3486 that path (measured with `fsr_dispatch_test` and `LEONIDA_FSR_NO_STANDIN=1`). 3493 that path (measured with `fsr_dispatch_test` and `LEONIDA_FSR_NO_STANDIN=1`).
diff --git a/docs/fspx.md b/docs/fspx.md
index 9736133a1..8888e540b 100644
--- a/docs/fspx.md
+++ b/docs/fspx.md
@@ -155,10 +155,20 @@ clamped total), so a malformed directory, or one without kind 0 or kind 6, gives
155pipeline's code base, which a translated shader reads its embedded constants through, is the kind-6 bytes: the 155pipeline's code base, which a translated shader reads its embedded constants through, is the kind-6 bytes: the
156translator's code offsets are into `fspx/<name>.code`. 156translator's code offsets are into `fspx/<name>.code`.
157 157
158The proxy maps slot 67's description onto `CreateComputePipelineState` with `CS` = the kind-6 pointer and size 158**Slot 67.** The proxy maps slot 67's description onto `CreateComputePipelineState` (#1714). When kind 0 is in the
159(#1714), which is the bare-program row above. Not done here: the console-only pipeline slot 11 the DLL calls after 159description, which the DLL always passes (its reader refuses a payload without one), the proxy builds one FSPX
160either path ([d3d12_command_objects.md](d3d12_command_objects.md) §3.5a), and using 160payload from the four pointer and size pairs (`leonida::fspx_payload_from_parts`) and passes that as `CS`, the
161kind 0 at run time beyond what the translated module already carries (its thread-group size and `RSRC2`). 161bare-payload row above. Two programs with the same code and different dispatch state therefore stay apart at slot 67
162too. Each pair is checked before it is read: a pointer without a size or a size without a pointer, a size over
16316 MiB, or a missing kind 6 refuses the call with `E_INVALIDARG`. Only a description without kind 0 still passes the
164kind-6 bytes alone (the bare-program row).
165
166**Slot 11.** After either path the DLL calls the pipeline's console slot 11. The Vulkan device's pipeline answers
167with a blob holding the dword 0, so the DLL creates no compute scratch buffer; why 0 is justified is in
168[d3d12_command_objects.md](d3d12_command_objects.md) §3.5a.
169
170Not done here: using kind 0 at run time beyond what the translated module already carries (its thread-group size
171and `RSRC2`).
162 172
163## Translation status 173## Translation status
164 174