feat(d3d12_x): translate graphics pipeline state to Vulkan #44

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

@⁠Dark3581 on GitHub · 2026-11-22 20:30 UTC · original
Dark3581:feat/graphics-pipeline-state → main · +1052 −7 · 19 files · 1 commits · merged 2026-11-22 20:43 UTC

What

The render-state half of graphics pipeline creation, the part that does not depend on a title's shaders or input layout:

  • pso/GraphicsState.cpp: D3D12_GRAPHICS_PIPELINE_STATE_DESC to Vulkan state. Blend (independent blend, dual-source factors, write masks, logic operations), rasterizer (fill, cull, winding, depth bias and clamp, depth clip as depth clamp), depth-stencil (both stencil faces; depth and stencil tests are off without a depth or stencil format, as in D3D12), sample count, mask and alpha to coverage, topology class and strip cut, and DXGI render target and depth formats (packed formats mapped by bit layout, for example R10G10B10A2 to A2B10G10R10_PACK32). Every enum is mapped by name. Tessellation, stream output, conservative rasterization, forced sample counts, unknown sample qualities, pipeline state flags, other nodes and formats without a mapping are refused with an error naming the value. The Vulkan features the state needs are recorded.
  • vulkan/GraphicsPipeline.cpp: creates the pipeline with dynamic rendering and the title layout. Viewports and scissors (with count), blend constants, stencil reference, the exact topology, primitive restart and vertex buffer strides are dynamic, because D3D12 sets them while recording. A state that needs a feature the device lacks is refused before reaching the driver.
  • Device: enables dynamicRendering (validation caught that it was missing) and, when offered, fillModeNonSolid, logicOp, depthClamp, depthBiasClamp, independentBlend and dualSrcBlend; loads vkCreateGraphicsPipelines.
  • Test shaders graphics_test.vert, graphics_float.frag, graphics_uint.frag with their compiled .inc, built the way BUILD.md describes.

The gaps (depth bias units for floating-point depth, ignored line modes, D24_UNORM_S8_UINT passed through, the winding assumption) are in the debt fragment.

Tested

Windows 10, MinGW build, RTX 3070 Ti (driver 621.14), Khronos validation layer from the Vulkan SDK 1.4.363.

  • pso_probe graphics-selftest (no GPU): format, blend, logic, compare, stencil, topology and sample mappings, 16 distinct logic ops, 8 compare and 8 stencil ops, the default description's state, three edited descriptions field by field, and 20 refusals with their messages.
  • pso_probe graphics-gpu --validate: 7 descriptions (opaque; three targets with independent blend and two-sided stencil on D32_FLOAT_S8X24; wireframe with front culling, depth bias and depth clamp on lines; 4x MSAA with alpha to coverage and a sample mask on points; XOR logic op on an integer target; depth only with strip cut; a gap in the render targets) create pipelines with 0 validation errors. Both run in the pipeline_state test.
  • ctest: 61 of 61. python tools/check_conventions.py: 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 and DXGI headers and documentation, Vulkan 1.3 specification
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 20:30 UTC · [original](https://github.com/Dark3581/AnyBox/pull/44) `Dark3581:feat/graphics-pipeline-state` → `main` · +1052 −7 · 19 files · 1 commits · merged 2026-11-22 20:43 UTC ### What The render-state half of graphics pipeline creation, the part that does not depend on a title's shaders or input layout: - **`pso/GraphicsState.cpp`**: `D3D12_GRAPHICS_PIPELINE_STATE_DESC` to Vulkan state. Blend (independent blend, dual-source factors, write masks, logic operations), rasterizer (fill, cull, winding, depth bias and clamp, depth clip as depth clamp), depth-stencil (both stencil faces; depth and stencil tests are off without a depth or stencil format, as in D3D12), sample count, mask and alpha to coverage, topology class and strip cut, and DXGI render target and depth formats (packed formats mapped by bit layout, for example `R10G10B10A2` to `A2B10G10R10_PACK32`). Every enum is mapped by name. Tessellation, stream output, conservative rasterization, forced sample counts, unknown sample qualities, pipeline state flags, other nodes and formats without a mapping are refused with an error naming the value. The Vulkan features the state needs are recorded. - **`vulkan/GraphicsPipeline.cpp`**: creates the pipeline with dynamic rendering and the title layout. Viewports and scissors (with count), blend constants, stencil reference, the exact topology, primitive restart and vertex buffer strides are dynamic, because D3D12 sets them while recording. A state that needs a feature the device lacks is refused before reaching the driver. - **Device**: enables `dynamicRendering` (validation caught that it was missing) and, when offered, `fillModeNonSolid`, `logicOp`, `depthClamp`, `depthBiasClamp`, `independentBlend` and `dualSrcBlend`; loads `vkCreateGraphicsPipelines`. - **Test shaders** `graphics_test.vert`, `graphics_float.frag`, `graphics_uint.frag` with their compiled `.inc`, built the way BUILD.md describes. The gaps (depth bias units for floating-point depth, ignored line modes, `D24_UNORM_S8_UINT` passed through, the winding assumption) are in the debt fragment. ### Tested Windows 10, MinGW build, RTX 3070 Ti (driver 621.14), Khronos validation layer from the Vulkan SDK 1.4.363. - `pso_probe graphics-selftest` (no GPU): format, blend, logic, compare, stencil, topology and sample mappings, 16 distinct logic ops, 8 compare and 8 stencil ops, the default description's state, three edited descriptions field by field, and 20 refusals with their messages. - `pso_probe graphics-gpu --validate`: 7 descriptions (opaque; three targets with independent blend and two-sided stencil on `D32_FLOAT_S8X24`; wireframe with front culling, depth bias and depth clamp on lines; 4x MSAA with alpha to coverage and a sample mask on points; XOR logic op on an integer target; depth only with strip cut; a gap in the render targets) create pipelines with 0 validation errors. Both run in the `pipeline_state` test. - `ctest`: 61 of 61. `python tools/check_conventions.py`: 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 and DXGI headers and documentation, Vulkan 1.3 specification - [x] AI-assisted: yes
GraphicsState turns a graphics pipeline state description's blend, rasterizer, depth-stencil, sample, topology class and target formats into Vulkan state and refuses what is not supported with an error naming it. GraphicsPipeline creates the pipeline with dynamic rendering, which the device now enables, and keeps viewports, scissors, blend constants, stencil reference, topology, primitive restart and vertex strides dynamic. The device also enables the render state features it offers. pso_probe gains a pure self test of every mapping and a GPU test that creates seven pipelines under the validation layer.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:15:25 +00:00
github manually merged commit 793cefa8fc into gh-pr/44/base 2026-11-26 19:15:27 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.