Skip to content

OLD-10021: PSOs honour RASTERIZER_DESC2 LineRasterizationMode through VK_EXT_line_rasterization (carries #290) - #1158

Closed
TimIdle wants to merge 4 commits into
ProjectLeonida:mainfrom
TimIdle:oldpr-10021-line-raster
Closed

TimIdle wants to merge 4 commits into
ProjectLeonida:mainfrom
TimIdle:oldpr-10021-line-raster

Conversation

@TimIdle

@TimIdle TimIdle commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: OLD-10021 (claim)

What and why

This carries forward old-pr/10021 by @tedin7 (draft #290). The four commits are cherry-picked onto main unchanged, with tedin7 kept as author.

main reads D3D12_RASTERIZER_DESC2 but drops LineRasterizationMode, so every line draws with the driver's default. With this change the layer enables VK_EXT_line_rasterization (no stippling) where the device has it and chains VkPipelineRasterizationLineStateCreateInfoEXT:

D3D12 mode Vulkan mode
ALIASED BRESENHAM
ALPHA_ANTIALIASED RECTANGULAR_SMOOTH
QUADRILATERAL_WIDE, QUADRILATERAL_NARROW RECTANGULAR (Vulkan has no narrow mode, so the two are the same here)

Bresenham and smooth lines are skipped when alpha-to-coverage is on (VUID 02766). The line mode is also part of the pipeline cache key for stream-created PSOs. The game's device comes from create_vulkan_device_standalone (d3d12_xs.cpp), which is the path that enables the extension.

Tested

Native Windows 11 10.0.26300, MSVC 19.44, RelWithDebInfo, LEONIDA_REQUIRE_VULKAN=ON, on main 42537e7 plus the four commits.

Check Result
d3d12_draw_test with the fix pass. Features on (Bresenham, smooth, rectangular all 1): aliased=52 alpha_antialiased=160(partial 108) quadrilateral_wide=52 quadrilateral_narrow=52. Features off: all four modes 52.
d3d12_draw_test with main's d3d12_vulkan_device.cpp fail: smooth lines covered 52 pixels, aliased 52 (the mode never reaches the driver)
d3d12_pso_validation_test PASS (60 layer checks, 100 host comparisons across 2 host devices)
full ctest -j 6 402 of 402 passed, gameinput disabled.

GPUs tested: NVIDIA GeForce RTX 2050 (Ampere GA107, laptop), driver 621.24, Windows 11

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator rule here.)

🤖 Generated with Claude Code

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified. Essential feature completion for \RASTERIZER_DESC2\ in D3D12/Vulkan pipeline creation (OLD-10021 / #290). Properly incorporates \LineRasterizationMode\ into the PSO cache key (\pipeline_key), maps Bresenham, smooth, and rectangular modes to \VK_EXT_line_rasterization\ via \VkPipelineRasterizationLineStateCreateInfoEXT, and preserves fallback behavior when extension features are unavailable. Verified in
untime/test/d3d12_vulkan_device_test.cpp. 100% clean-room.

@madhyn

madhyn commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tested d0a33438c on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / clang-cl + xwin cross-build):

  • d3d12_draw: Passed (5.43 s)
  • d3d12_pso_validation: Passed (5.46 s)

AI-assisted: yes

@TimIdle

TimIdle commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the Wine run on the RTX 3060 Ti. With the native Windows run in the description, both test files now pass on two hosts.

@Deedlyy

Deedlyy commented Nov 24, 2026

Copy link
Copy Markdown

Recommendation: [MERGE]

Reasoning: Carries #290: PSOs honour RASTERIZER_DESC2.LineRasterizationMode through VK_EXT_line_rasterization where available (no stippling). Fixes lines always drawing with the driver default. Adds new draw and validation tests. Verified on native Windows (author) and Wine + RTX 3060 Ti (madhyn). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 5/10

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
@TimIdle
TimIdle force-pushed the oldpr-10021-line-raster branch from d0a3343 to cb41dd0 Compare November 25, 2026 00:09
@TimIdle

TimIdle commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 364ab4e. The one conflict was the create_graphics signature, where #878 added back_masks. Both parameters are kept, with line_mode after back_masks. On the RTX 2050 the rebased head gives the same line counts as before (smooth 160 pixels, aliased 52), d3d12_pso_validation_test passes, and the full ctest is 316 of 316.

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@TimIdle
TimIdle force-pushed the oldpr-10021-line-raster branch from cb41dd0 to 6112a00 Compare November 25, 2026 02:02
@TimIdle

TimIdle commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main c266c26. The one conflict was the end of CreatePipelineState for a stream, where main now wraps the result in finish() and records mesh pipelines. The line-mode cache key is still set before the pipeline is handed out. On the RTX 2050 the line counts are unchanged (smooth 160 pixels, aliased 52), d3d12_pso_validation_test passes, and the full ctest is 361 of 361.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@TimIdle
TimIdle force-pushed the oldpr-10021-line-raster branch from 6112a00 to bd770c1 Compare November 25, 2026 05:57
@TimIdle

TimIdle commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 42537e7. The one conflict was in runtime/test/vk_test_device.h, where main moved the external-memory-host query higher up, so only the line-rasterization block of this PR stays at that spot. On the RTX 2050 the line counts are unchanged (smooth 160 pixels, aliased 52), d3d12_pso_validation_test passes, and the full ctest is 402 of 402.

@github-actions github-actions Bot added needs rebase Conflicts with the base branch: rebase it on main and removed needs rebase Conflicts with the base branch: rebase it on main labels Nov 25, 2026
@TimIdle

TimIdle commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing this one, no review yet and CI is red. Will reopen if it is still needed.

@TimIdle TimIdle closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants