diff options
| author | iFeyz <62035583+iFeyz@users.noreply.github.com> | 2026-11-24 16:45:13 +0100 |
|---|---|---|
| committer | iFeyz <62035583+iFeyz@users.noreply.github.com> | 2026-11-24 16:50:49 +0100 |
| commit | 5fdd6abbc07a0b2e4120944b4e624e3a70ddb76e (patch) | |
| tree | 22a6ccd466c4e735b5d78e1912d55d3c0a2e8a2a /docs/d3d12_vulkan.md | |
| parent | 1504c1af63aeab49fb451ee42d3d051b29d4c976 (diff) | |
D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window
The graphics bind point laid root arguments out with pack() (from s0, two
dwords per table), while the console starts them at s8 for VS/PS/GS with
one dword per table (the corpus census, and the retail frame loop reading
its tables at s8..s10). Compute already took the console layout (D3D-448);
graphics waited because a mesh shader (s16) and a pixel shader (s8) share
one push-constant block.
- translator: user_data_dword() - a mesh shader loads s16..s31 from push
dwords 8..23, s8..s15 as 0, s0..s7 unchanged, so root dword k is push
dword 8 + k for every graphics stage; index.json records the window as
"root_window" on mesh shaders. VS/PS/GS/CS are unchanged.
- runtime: CreateRootSignature lays graphics out with
pack_stage(Stage::Vertex) and checks Stage::Mesh (mesh_ok); a table is
one dword at both bind points; DispatchMesh with a signature past the
16-dword mesh window invalidates the list; a mesh PSO whose mesh shader
has no root_window (translated before) is refused with a log line.
- fixtures: the GLSL stand-ins read the root arguments at push dword 8 + k;
the M1.5/M2/M3 asm read their tables as one dword from s8.
- tests: tests/semantic/test_ms_root_window.py (MeshEXT and --mesh-compute
on the CPU interpreter), graphics-window cases in root_signature_test,
the two refusals in d3d12_mesh_test.
- docs: d3d12_vulkan.md 3.5, design.md user-data row.
Diffstat (limited to 'docs/d3d12_vulkan.md')
| -rw-r--r-- | docs/d3d12_vulkan.md | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 8bf2bd38e..fef8f53cb 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -794,9 +794,11 @@ The compute path, end to end: | |||
| 794 | so descriptor bytes the application writes itself are what shaders load. | 794 | so descriptor bytes the application writes itself are what shaders load. |
| 795 | - Upload and readback buffers keep their own memory, and their VA is their device address minus the heap base. | 795 | - Upload and readback buffers keep their own memory, and their VA is their device address minus the heap base. |
| 796 | - Shader programs (FSSM blobs) are copied in as the code base. | 796 | - Shader programs (FSSM blobs) are copied in as the code base. |
| 797 | - **`CreateRootSignature`** parses the blob with `parse_rts0` and keeps each parameter's place in two layouts: | 797 | - **`CreateRootSignature`** parses the blob with `parse_rts0` and keeps each parameter's place in two layouts, both |
| 798 | `pack()` for the graphics bind point and `pack_stage(Stage::Compute)` for the compute one (from s4, one dword per | 798 | the console's (one dword per table; section 3.5, D3D-448): `pack_stage(Stage::Vertex)` for the graphics bind point |
| 799 | table; section 3.5, D3D-448). A signature neither can place (more than 32 user dwords: the spill layout is open; the | 799 | (from s8, the graphics root window) and `pack_stage(Stage::Compute)` for the compute one (from s4). It also checks |
| 800 | `pack_stage(Stage::Mesh)`: a signature past a mesh shader's 16-dword window is logged, and `DispatchMesh` with it | ||
| 801 | invalidates the list. A signature neither bind point can place (past s31: the spill layout is open; the | ||
| 800 | translated shaders have no below-base spill-pointer candidates) is refused with both reasons; one only a single layout places is created with a log line, and binding it at the other bind point | 802 | translated shaders have no below-base spill-pointer candidates) is refused with both reasons; one only a single layout places is created with a log line, and binding it at the other bind point |
| 801 | invalidates the list. Before | 803 | invalidates the list. Before |
| 802 | that it answers as the host runtime does (`compare_invalid_arguments`, "root signature:", RTX 5070 / 621.14): | 804 | that it answers as the host runtime does (`compare_invalid_arguments`, "root signature:", RTX 5070 / 621.14): |
| @@ -1714,7 +1716,8 @@ This is the least verifiable part of the layer. D3D12 gives the application a ro | |||
| 1714 | turns it into the user SGPRs (`s0..s31`) that the shader reads. The translator already copies those 32 dwords from | 1716 | turns it into the user SGPRs (`s0..s31`) that the shader reads. The translator already copies those 32 dwords from |
| 1715 | push constants into `s0..s31`. The layer must produce them. | 1717 | push constants into `s0..s31`. The layer must produce them. |
| 1716 | 1718 | ||
| 1717 | The default mapping (implemented by `rt::rootsig::pack` in `runtime/src/root_signature.{h,cpp}`) follows root | 1719 | The first mapping the layer used (`rt::rootsig::pack` in `runtime/src/root_signature.{h,cpp}`, kept for the tools and |
| 1720 | tests that compare the two models; the runtime now uses the console layout below at both bind points) follows root | ||
| 1718 | parameter order: | 1721 | parameter order: |
| 1719 | 1722 | ||
| 1720 | | Root parameter | User-data dwords | | 1723 | | Root parameter | User-data dwords | |
| @@ -1754,12 +1757,23 @@ below 4 GiB). A parameter that does not fit goes, with every later one, to the s | |||
| 1754 | - **Vertex/pixel/geometry s8 and mesh s16: a hypothesis.** It rests on the census above only; no signature | 1757 | - **Vertex/pixel/geometry s8 and mesh s16: a hypothesis.** It rests on the census above only; no signature |
| 1755 | confirms these bases, and visibility is not modelled (every parameter takes its place in every stage). | 1758 | confirms these bases, and visibility is not modelled (every parameter takes its place in every stage). |
| 1756 | 1759 | ||
| 1757 | The runtime uses the console layout for the **compute** bind point only. Graphics keeps `pack()`: every stage of a | 1760 | The runtime uses the console layout at **both** bind points. Every stage of a pipeline reads one push-constant block |
| 1758 | pipeline reads `s0..s31` from one push-constant block at offset 0 (`tools/rdna2spirv.py`, `ShaderUserData` in | 1761 | (`ShaderUserData` in `runtime/src/vulkan_replay.h`), so the graphics bind point lays a signature out once with |
| 1759 | `runtime/src/vulkan_replay.h`), so a mesh shader (base s16) and a pixel shader (base s8) in one pipeline would need | 1762 | `pack_stage(Stage::Vertex)`: root dword k at push dword 8 + k. A vertex, pixel or geometry shader reads SGPR i from |
| 1760 | the same root argument at two offsets. That needs per-stage user-data windows in the translator's push-constant | 1763 | push dword i, so it finds the arguments at s8.. as the console puts them. **The graphics root window (D3D-448 |
| 1761 | contract (D3D-448 follow-up). A root signature carries both layouts; one that only one of them can place is | 1764 | follow-up):** a mesh shader's root arguments start at s16, so the translator loads its s16..s31 from push dwords |
| 1762 | created, and binding it at the other bind point invalidates the command list (`Close` returns `E_INVALIDARG`). | 1765 | 8..23 instead (`user_data_dword` in `tools/rdna2spirv.py`); a mesh and a pixel shader of one pipeline then find each |
| 1766 | argument in the same dword. A mesh shader's s8..s15 are below its base and read 0; s0..s7 stay push dwords 0..7 | ||
| 1767 | for every stage. The index records the window as `"root_window": {"sgpr": 16, "dword": 8}`, and a mesh PSO whose | ||
| 1768 | mesh shader lacks it (translated before) is refused with a log line asking for the shaders stage again. The mesh | ||
| 1769 | window holds 16 dwords (s16..s31) where the others hold 24 (s8..s31): a signature that fits the graphics layout but | ||
| 1770 | not the mesh window is created with a log line, and `DispatchMesh` with it invalidates the list. Live evidence for | ||
| 1771 | s8 and one dword per table: on the retail frame loop the VS of a textured draw reads table slots 0 and 2 through s8 | ||
| 1772 | and its PS slot 1, which hold exactly the buffer, constants and texture the title bound (issue #14, comment | ||
| 1773 | 7131556366, native Windows, RTX 5080). What a mesh shader reads in s8..s15 is not measured: | ||
| 1774 | `user_sgpr_census.py --base ms=16` on a corpus lists any read below s16. A root signature carries both layouts; | ||
| 1775 | one that only one of them can place is created, and binding it at the other bind point invalidates the command list | ||
| 1776 | (`Close` returns `E_INVALIDARG`). | ||
| 1763 | `s0..s3` of a compute dispatch are the driver's block; the layer leaves them zero (109 CS read `s1` as a constant, | 1777 | `s0..s3` of a compute dispatch are the driver's block; the layer leaves them zero (109 CS read `s1` as a constant, |
| 1764 | 42 `s3`; their meaning is open). | 1778 | 42 `s3`; their meaning is open). |
| 1765 | 1779 | ||