feat(d3d12_x): lay out root signatures deserialized through the host d3d12.dll #56

Manually merged
github merged 1 commit from gh-pr/56/head into gh-pr/56/base 2026-11-26 19:16:29 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 23:41 UTC · original
Dark3581:feat/root-signature-layout → main · +428 −2 · 8 files · 1 commits · merged 2026-11-22 23:45 UTC

What

The generic half of CreateRootSignature:

  • pso/RootSignatureLayout.cpp: DeserializeRootSignature takes a serialized root signature, deserializes it with the host d3d12.dll's D3D12CreateVersionedRootSignatureDeserializer (loaded from the system folder, not AnyBox's own export) and converts it to version 1.1, so 1.0 and 1.1 blobs give the same layout. BuildRootSignatureLayout lays a description out:
    • each parameter with its type, visibility, register and space, and its desktop D3D12 cost in 32-bit words (root constants their count, root CBV/SRV/UAV two, descriptor tables one) with the first word it starts at; more than 64 words is refused;
    • descriptor tables with their ranges copied (1.0 ranges converted to 1.1), refusing empty tables and ranges, unknown range types, tables that mix samplers with other descriptors and unbounded ranges before the last;
    • static samplers converted to sampler descriptions (the three static border colors) and translated with #50's TranslateSampler;
    • unknown flags, visibilities, types and versions refused with the value named.
  • The layout is deep-copied before the host deserializer is released.

Where each of those words lands in a translated shader's user registers is console-specific and not known; the layout is not that mapping, and the debt fragment says so. Blobs carrying the console flag bits are rejected by the host, as RootSignature.cpp's entry already notes.

Tested

  • pso_probe rootsig-selftest: a 1.1 description with root constants, a root CBV, a view table with an unbounded range in another space, a sampler table and two static samplers is laid out and checked field by field (words 8, first words 0/4/6/7, ranges, static sampler compare and border color); the same description serialized by the host and deserialized gives the same layout; a 1.0 blob deserializes converted to 1.1; a junk blob is rejected; 9 refusals (over 64 words, a mixed table, an unbounded range first, an empty table, zero constants, a bad visibility, a bad border color, the console flag bits, an unknown version). Writing it, the host serializer rejected the first draft because its static samplers overlapped the sampler table's registers; the test now puts them in another space. Runs in the pipeline_state test.
  • MinGW ctest: 66 of 66. With MSVC 2022 the d3d12_x targets build and the self test passes. python tools/check_conventions.py and debt_fold.py --check: ok.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: public D3D12 root signature documentation and the host d3d12.dll serializer and deserializer
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 23:41 UTC · [original](https://github.com/Dark3581/AnyBox/pull/56) `Dark3581:feat/root-signature-layout` → `main` · +428 −2 · 8 files · 1 commits · merged 2026-11-22 23:45 UTC ### What The generic half of `CreateRootSignature`: - **`pso/RootSignatureLayout.cpp`**: `DeserializeRootSignature` takes a serialized root signature, deserializes it with the host `d3d12.dll`'s `D3D12CreateVersionedRootSignatureDeserializer` (loaded from the system folder, not AnyBox's own export) and converts it to version 1.1, so 1.0 and 1.1 blobs give the same layout. `BuildRootSignatureLayout` lays a description out: - each parameter with its type, visibility, register and space, and its desktop D3D12 cost in 32-bit words (root constants their count, root CBV/SRV/UAV two, descriptor tables one) with the first word it starts at; more than 64 words is refused; - descriptor tables with their ranges copied (1.0 ranges converted to 1.1), refusing empty tables and ranges, unknown range types, tables that mix samplers with other descriptors and unbounded ranges before the last; - static samplers converted to sampler descriptions (the three static border colors) and translated with #50's `TranslateSampler`; - unknown flags, visibilities, types and versions refused with the value named. - The layout is deep-copied before the host deserializer is released. Where each of those words lands in a translated shader's user registers is console-specific and not known; the layout is not that mapping, and the debt fragment says so. Blobs carrying the console flag bits are rejected by the host, as `RootSignature.cpp`'s entry already notes. ### Tested - `pso_probe rootsig-selftest`: a 1.1 description with root constants, a root CBV, a view table with an unbounded range in another space, a sampler table and two static samplers is laid out and checked field by field (words 8, first words 0/4/6/7, ranges, static sampler compare and border color); the same description serialized by the host and deserialized gives the same layout; a 1.0 blob deserializes converted to 1.1; a junk blob is rejected; 9 refusals (over 64 words, a mixed table, an unbounded range first, an empty table, zero constants, a bad visibility, a bad border color, the console flag bits, an unknown version). Writing it, the host serializer rejected the first draft because its static samplers overlapped the sampler table's registers; the test now puts them in another space. Runs in the `pipeline_state` test. - MinGW `ctest`: 66 of 66. With MSVC 2022 the `d3d12_x` targets build and the self test passes. `python tools/check_conventions.py` and `debt_fold.py --check`: ok. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: public D3D12 root signature documentation and the host `d3d12.dll` serializer and deserializer - [x] AI-assisted: yes
DeserializeRootSignature reads a root signature blob through the host d3d12.dll's versioned deserializer at version 1.1 and BuildRootSignatureLayout lays it out: parameters with their desktop cost in 32-bit words and their first word (64 at most), descriptor tables with their ranges checked (no mixed sampler tables, unbounded ranges only last), and static samplers translated to Vulkan samplers with their preset border colors. Where those words go in the shaders' user registers is not part of it. pso_probe gains a self test that checks a built layout, round-trips 1.1 and 1.0 blobs serialized by the host and checks 9 refusals.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:16:27 +00:00
github manually merged commit ee8c4eecd9 into gh-pr/56/base 2026-11-26 19:16:29 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.