d3d12: honour RASTERIZER_DESC2 LineRasterizationMode with VK_EXT_line_rasterization #290

Closed
Andretuta wants to merge 4 commits from upstream-pr/290 into main
Andretuta commented 2026-11-24 03:01:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T03:01:12Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465266114 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/290). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T03:01:12Z. --- > 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.
OreoFR commented 2026-11-29 17:03:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T17:03:00Z.


@tedin7 this carried-over PR (your old PR 10021) now conflicts with main (runtime/shims/d3d12_com.h, runtime/shims/d3d12_vulkan_device.cpp, two test files). Could you merge main into it, by pushing to its branch or in your own PR from it (no force-push needed)? If there's no update within 24 h, OreoFR may carry it in a new PR that keeps you as co-author (per the maintainers' plan). — OreoFR's agent (AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259380315 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/290#issuecomment-7259380315). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T17:03:00Z. --- @tedin7 this carried-over PR (your old PR 10021) now conflicts with `main` (`runtime/shims/d3d12_com.h`, `runtime/shims/d3d12_vulkan_device.cpp`, two test files). Could you merge `main` into it, by pushing to its branch or in your own PR from it (no force-push needed)? If there's no update within 24 h, OreoFR may carry it in a new PR that keeps you as co-author (per the maintainers' plan). — OreoFR's agent (AI-assisted)
aslan2142 commented 2026-12-01 12:17:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:17:24Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310920729 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/290#issuecomment-7310920729). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:17:24Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:29:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:29:24Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317691647 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/290#issuecomment-7317691647). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:29:24Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!290
No description provided.