feat(d3d12_x): add the bindless descriptor set and the descriptor hash table #35

Manually merged
github merged 1 commit from gh-pr/35/head into gh-pr/35/base 2026-11-26 19:14:48 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 10:53 UTC · original
Dark3581:feat/bindless-descriptors → main · +1212 −38 · 17 files · 1 commits · merged 2026-11-22 10:56 UTC

What

The bindless descriptor side of the Vulkan backend (#4): how a translated shader turns a T# or S# into a descriptor.

  • DescriptorHashTable builds the table translated shaders search at set 0 binding 2: word 0 the mask, then ten words per slot (an eight-word key, the bindless index, padding); FNV-1a over the eight key words; eight slots probed from the hash; a miss resolves to index 0. An S# key is its four words followed by four 0xFFFFFFFF. Insert places a key within its eight slots or grows the table; erase clears a slot (the lookup does not stop at empty slots, so later keys stay reachable). The all-zero key and index 0 are refused, since an empty slot would match the zero key first.
  • BindlessSet allocates the title layout's descriptor set from an update-after-bind pool, puts fallbacks at index 0 of every binding (zeroed 1x1 images in each dimension and component class, R32_UINT where the binding declares it, and a nearest clamp-to-edge sampler), and uploads the table to binding 2, growing its buffer as needed. WriteImage and WriteSampler fill other slots.
  • Title layout: each image binding now records its component type and declared format. Bindings 4 and 7 declare R32ui; every other image binding uses unknown-format views of float, uint or sint components. tools/spirv_layout.py compares both, so shaders_layout now also catches a format or component mismatch.
  • VulkanDevice gains buffer, image, sampler, descriptor and command functions, a memory type query and a one-shot Submit.
  • anybox-pipeline-probe bindless checks the table end to end: hash test vectors, 3,000 image and 200 sampler keys inserted (with growth), a replaced index, 300 erased keys, 500 absent keys and the zero key, then a GPU compute shader that runs the same lookup over binding 2 must return the CPU table's answer for every key. The shader's GLSL source sits next to its compiled words (core/libs/probe/shaders/), with the regeneration command in BUILD.md.
  • Debt fragment for DescriptorTable and BindlessSet.

Tested

  • Windows 10, MinGW GCC 15.2, RTX 3070 Ti, Vulkan SDK 1.4.363 validation layer: 60 of 60 tests pass; check_conventions.py and debt_fold.py --check pass.
  • bindless: 2,900 entries in 16,384 slots (grown from 1,024), 14 fallback images, 3,701 of 3,701 GPU lookups equal to the CPU table, 0 validation errors.
  • Hash test vectors were computed with an independent Python FNV-1a.
  • On one title's store: shaders_layout with the format and component check finds all 25,889 modules fit (all twenty bindings' formats reflected from the modules); shaders_compute 60 of 60 with 0 validation errors. No game data in the PR.

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: #34 (merged)
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: table format and lookup from the translator's generated SPIR-V; image formats and component types read from translated modules; Vulkan behaviour from the specification and the validation layer
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 10:53 UTC · [original](https://github.com/Dark3581/AnyBox/pull/35) `Dark3581:feat/bindless-descriptors` → `main` · +1212 −38 · 17 files · 1 commits · merged 2026-11-22 10:56 UTC ### What The bindless descriptor side of the Vulkan backend (#4): how a translated shader turns a T# or S# into a descriptor. - **`DescriptorHashTable`** builds the table translated shaders search at set 0 binding 2: word 0 the mask, then ten words per slot (an eight-word key, the bindless index, padding); FNV-1a over the eight key words; eight slots probed from the hash; a miss resolves to index 0. An S# key is its four words followed by four `0xFFFFFFFF`. Insert places a key within its eight slots or grows the table; erase clears a slot (the lookup does not stop at empty slots, so later keys stay reachable). The all-zero key and index 0 are refused, since an empty slot would match the zero key first. - **`BindlessSet`** allocates the title layout's descriptor set from an update-after-bind pool, puts fallbacks at index 0 of every binding (zeroed 1x1 images in each dimension and component class, `R32_UINT` where the binding declares it, and a nearest clamp-to-edge sampler), and uploads the table to binding 2, growing its buffer as needed. `WriteImage` and `WriteSampler` fill other slots. - **Title layout**: each image binding now records its component type and declared format. Bindings 4 and 7 declare `R32ui`; every other image binding uses unknown-format views of float, uint or sint components. `tools/spirv_layout.py` compares both, so `shaders_layout` now also catches a format or component mismatch. - **`VulkanDevice`** gains buffer, image, sampler, descriptor and command functions, a memory type query and a one-shot `Submit`. - **`anybox-pipeline-probe bindless`** checks the table end to end: hash test vectors, 3,000 image and 200 sampler keys inserted (with growth), a replaced index, 300 erased keys, 500 absent keys and the zero key, then a GPU compute shader that runs the same lookup over binding 2 must return the CPU table's answer for every key. The shader's GLSL source sits next to its compiled words (`core/libs/probe/shaders/`), with the regeneration command in BUILD.md. - Debt fragment for `DescriptorTable` and `BindlessSet`. ### Tested - Windows 10, MinGW GCC 15.2, RTX 3070 Ti, Vulkan SDK 1.4.363 validation layer: 60 of 60 tests pass; `check_conventions.py` and `debt_fold.py --check` pass. - `bindless`: 2,900 entries in 16,384 slots (grown from 1,024), 14 fallback images, 3,701 of 3,701 GPU lookups equal to the CPU table, 0 validation errors. - Hash test vectors were computed with an independent Python FNV-1a. - On one title's store: `shaders_layout` with the format and component check finds all 25,889 modules fit (all twenty bindings' formats reflected from the modules); `shaders_compute` 60 of 60 with 0 validation errors. No game data in the PR. ### 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: #34 (merged) - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: table format and lookup from the translator's generated SPIR-V; image formats and component types read from translated modules; Vulkan behaviour from the specification and the validation layer - [x] AI-assisted: yes
DescriptorHashTable builds the table the translated shaders search for a
descriptor's bindless index, in the format their generated lookup reads.
BindlessSet allocates the title layout's descriptor set, puts zeroed
fallback images and a fallback sampler at index 0 of every binding, and
uploads the table to binding 2. The title layout now also records each
image binding's component type and declared format, which
tools/spirv_layout.py compares. anybox-pipeline-probe bindless checks the
table on the GPU with a shader that runs the same lookup.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:46 +00:00
github manually merged commit b81d46705d into gh-pr/35/base 2026-11-26 19:14:48 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.