d3d12: honour RASTERIZER_DESC2 LineRasterizationMode with VK_EXT_line_rasterization #290

Open
github-bot wants to merge 4 commits from github-bot/gh-290 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:01 UTC · original
ubiquitarianism:old-pr/10021 → main · +364 −3 · 5 files · 4 commits · draft

Carried over from old PR 10021 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10021, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What

A graphics PSO created from the pipeline-state stream now honours D3D12_RASTERIZER_DESC2::LineRasterizationMode (it was dropped, every LINE_LIST drew with Vulkan's default line state).

  • ALIASED -> VK_LINE_RASTERIZATION_MODE_BRESENHAM, ALPHA_ANTIALIASED -> RECTANGULAR_SMOOTH, QUADRILATERAL_WIDE and NARROW -> RECTANGULAR. Vulkan has no narrow quadrilateral mode, so WIDE and NARROW are one mode here (noted in a comment and in the test).
  • The line state is not chained when the device lacks the matching VK_EXT_line_rasterization feature, and for Bresenham/smooth it is left out when alpha-to-coverage is on (VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766).
  • The mode is part of the PSO cache key, so two streams that differ only in line mode do not share a pipeline.
  • Test device (vk_test_device.h) can request the extension; d3d12_draw_test draws a LINE_LIST per mode and counts pixels; d3d12_pso_validation_test checks the refusals.

Why

Lines are drawn by the game's debug/overlay and some world passes; with the mode ignored, ALPHA_ANTIALIASED lines came out aliased and the VUID above could fire as a validation error on a device with alpha-to-coverage PSOs. It is part of getting 3D rendering state right once a PSO is built.

Tested

Local: clang-cl 19 + xwin SDK cross build, run under Wine on lavapipe (llvmpipe, LLVM 19.1.7). No real GPU. Built on current main plus #9809 applied only in a scratch tree (main does not build right now, issue #9812); that patch is not in this PR.

  • d3d12_pso_validation_test: PASS, 60 layer checks.
  • d3d12_draw_test: exit 0. Line modes, features on (bresenham 1 smooth 1 rectangular 1): aliased=52 pixels (partial 0), alpha_antialiased=160 (partial 112), quadrilateral_wide=52, quadrilateral_narrow=52. Features off: all four 52 (partial 0), so no line state is chained.
  • Negative control: same test, shim fix reverted (main's d3d12_vulkan_device.cpp, new test kept): d3d12_draw_test exits 1 at the line-mode check. With the fix it exits 0.

Not run: the whole runtime suite, real NVIDIA/AMD hardware, Windows host comparisons (Wine's D3D12 is not Microsoft's, those are skipped).

Rebased cleanly on current main; supersedes #8716 closed during org migration.

**@⁠Andretuta** on GitHub · 2026-11-24 03:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/290) `ubiquitarianism:old-pr/10021` → `main` · +364 −3 · 5 files · 4 commits · draft > Carried over from **old PR 10021** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10021`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## What A graphics PSO created from the pipeline-state stream now honours `D3D12_RASTERIZER_DESC2::LineRasterizationMode` (it was dropped, every LINE_LIST drew with Vulkan's default line state). - ALIASED -> `VK_LINE_RASTERIZATION_MODE_BRESENHAM`, ALPHA_ANTIALIASED -> `RECTANGULAR_SMOOTH`, QUADRILATERAL_WIDE and NARROW -> `RECTANGULAR`. Vulkan has no narrow quadrilateral mode, so WIDE and NARROW are one mode here (noted in a comment and in the test). - The line state is not chained when the device lacks the matching `VK_EXT_line_rasterization` feature, and for Bresenham/smooth it is left out when alpha-to-coverage is on (VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766). - The mode is part of the PSO cache key, so two streams that differ only in line mode do not share a pipeline. - Test device (`vk_test_device.h`) can request the extension; `d3d12_draw_test` draws a LINE_LIST per mode and counts pixels; `d3d12_pso_validation_test` checks the refusals. ## Why Lines are drawn by the game's debug/overlay and some world passes; with the mode ignored, ALPHA_ANTIALIASED lines came out aliased and the VUID above could fire as a validation error on a device with alpha-to-coverage PSOs. It is part of getting 3D rendering state right once a PSO is built. ## Tested Local: clang-cl 19 + xwin SDK cross build, run under Wine on lavapipe (llvmpipe, LLVM 19.1.7). No real GPU. Built on current main plus `#9809` applied only in a scratch tree (main does not build right now, issue `#9812`); that patch is not in this PR. - `d3d12_pso_validation_test`: PASS, 60 layer checks. - `d3d12_draw_test`: exit 0. Line modes, features on (bresenham 1 smooth 1 rectangular 1): aliased=52 pixels (partial 0), alpha_antialiased=160 (partial 112), quadrilateral_wide=52, quadrilateral_narrow=52. Features off: all four 52 (partial 0), so no line state is chained. - Negative control: same test, shim fix reverted (main's d3d12_vulkan_device.cpp, new test kept): `d3d12_draw_test` exits 1 at the line-mode check. With the fix it exits 0. Not run: the whole runtime suite, real NVIDIA/AMD hardware, Windows host comparisons (Wine's D3D12 is not Microsoft's, those are skipped). Rebased cleanly on current main; supersedes `#8716` closed during org migration.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:07 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/shims/d3d12_vulkan_device.cpp
  • runtime/test/d3d12_draw_test.cpp
  • runtime/test/vk_test_device.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/290/head:github-bot/gh-290'
git switch 'github-bot/gh-290'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-290'
git switch 'github-bot/gh-290'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-290'
git switch 'github-bot/gh-290'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-290'
git switch 'main'
git merge --squash 'github-bot/gh-290'
git switch 'main'
git merge --ff-only 'github-bot/gh-290'
git switch 'main'
git merge 'github-bot/gh-290'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.