feat(d3d12_x): create graphics pipelines through the pipeline library, cache first #47

Manually merged
github merged 1 commit from gh-pr/47/head into gh-pr/47/base 2026-11-26 19:15:44 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 21:12 UTC · original
Dark3581:feat/pipeline-library-graphics → main · +399 −5 · 10 files · 1 commits · merged 2026-11-22 21:15 UTC

What

The full translation of a graphics pipeline state description, ready for the device's CreateGraphicsPipelineState:

  • GraphicsPipelineRequest (pso/PipelineState.cpp): resolves the vertex, geometry and pixel shaders through the store (each with a stage check and its own error), translates the render state (#44) and the input layout against the vertex shader's inputs (#46), and keys the request by the shader keys plus an encoding of every translated field, so equal descriptions share one pipeline and any state difference gives another. A geometry shader adds the geometryShader requirement. A cached pipeline blob is ignored, as for compute.
  • PipelineLibrary::Graphics: the same cache-first rule as compute. It asks the driver for the pipeline without compiling, compiles only when that fails, refuses a pipeline whose modules together are over the run-time compile limit, and creates each key once even when several threads ask at the same time. Compute and graphics now share one slot path (Obtain), with separate key spaces.
  • GraphicsStateKey (vulkan/GraphicsPipeline.cpp) encodes the translated state and vertex input.
  • pso_probe: dump-test-shaders writes the embedded test SPIR-V, and graphics runs a description through store, request and library on four threads (seven requests over two states).

Tested

Windows 10, MinGW build, RTX 3070 Ti (driver 621.14).

  • pipeline_state builds a store from the test shaders (a plain vertex shader, one with three inputs, a pixel shader) and checks: the three error paths (an uncovered input, a pixel shader as vertex shader, a vertex shader as pixel shader); seven concurrent requests over two keys give exactly two pipelines, the same handle per key; a saved cache gives ready for both on the next run; the vertex-input pipeline (3 attributes); with an empty cache and a 16-byte limit nothing is compiled.
  • shaders_pso on one title's store still passes (12 compute shaders, the largest refused, 8 title vertex shaders as graphics pipelines, 9 of 13 from the offline cache).
  • ctest: 66 of 66. python tools/check_conventions.py and debt_fold.py --check: ok. No bare std::min/std::max.

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 pipeline state documentation, Vulkan 1.3 pipeline creation cache control
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 21:12 UTC · [original](https://github.com/Dark3581/AnyBox/pull/47) `Dark3581:feat/pipeline-library-graphics` → `main` · +399 −5 · 10 files · 1 commits · merged 2026-11-22 21:15 UTC ### What The full translation of a graphics pipeline state description, ready for the device's `CreateGraphicsPipelineState`: - **`GraphicsPipelineRequest`** (`pso/PipelineState.cpp`): resolves the vertex, geometry and pixel shaders through the store (each with a stage check and its own error), translates the render state (#44) and the input layout against the vertex shader's inputs (#46), and keys the request by the shader keys plus an encoding of every translated field, so equal descriptions share one pipeline and any state difference gives another. A geometry shader adds the `geometryShader` requirement. A cached pipeline blob is ignored, as for compute. - **`PipelineLibrary::Graphics`**: the same cache-first rule as compute. It asks the driver for the pipeline without compiling, compiles only when that fails, refuses a pipeline whose modules together are over the run-time compile limit, and creates each key once even when several threads ask at the same time. Compute and graphics now share one slot path (`Obtain`), with separate key spaces. - `GraphicsStateKey` (`vulkan/GraphicsPipeline.cpp`) encodes the translated state and vertex input. - `pso_probe`: `dump-test-shaders` writes the embedded test SPIR-V, and `graphics` runs a description through store, request and library on four threads (seven requests over two states). ### Tested Windows 10, MinGW build, RTX 3070 Ti (driver 621.14). - `pipeline_state` builds a store from the test shaders (a plain vertex shader, one with three inputs, a pixel shader) and checks: the three error paths (an uncovered input, a pixel shader as vertex shader, a vertex shader as pixel shader); seven concurrent requests over two keys give exactly two pipelines, the same handle per key; a saved cache gives `ready` for both on the next run; the vertex-input pipeline (3 attributes); with an empty cache and a 16-byte limit nothing is compiled. - `shaders_pso` on one title's store still passes (12 compute shaders, the largest refused, 8 title vertex shaders as graphics pipelines, 9 of 13 from the offline cache). - `ctest`: 66 of 66. `python tools/check_conventions.py` and `debt_fold.py --check`: ok. No bare `std::min`/`std::max`. ### 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 pipeline state documentation, Vulkan 1.3 pipeline creation cache control - [x] AI-assisted: yes
GraphicsPipelineRequest resolves a graphics pipeline state description's vertex, geometry and pixel shaders through the store and combines them with the translated render state and vertex input into one request, keyed by the shader keys and the state. PipelineLibrary::Graphics creates each such pipeline once, thread-safe, asking the driver first without compiling and refusing pipelines whose modules are over the run-time compile limit, sharing its slot logic with compute. pso_probe gains dump-test-shaders and graphics, which the pipeline_state test drives through a store built from the test shaders.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:15:43 +00:00
github manually merged commit 5ae722f26f into gh-pr/47/base 2026-11-26 19:15:44 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.