Skip to content

runtime: graphics pipelines on a Vulkan 1.2 device through VK_EXT_extended_dynamic_state(2) (RT-121) - #1924

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
ashiikins:runtime-vulkan12-eds
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
ashiikins:runtime-vulkan12-eds

Conversation

@ashiikins

@ashiikins ashiikins commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-121 (claim, recorded in #1745)

Follow-up to #1706 (merged); main is merged in, so the diff is only this change.

What and why

With #1706, a Vulkan 1.2 device such as CrossOver's MoltenVK 1.2.10 (macOS, arm64 Wine) is accepted, but CreateGraphicsPipelineState is still refused ("graphics pipelines need Vulkan 1.3 dynamic rendering and extended dynamic state"). The graphics pipelines use the 1.3 core dynamic states (primitive topology, primitive restart, vertex binding stride) and their commands (vkCmdBindVertexBuffers2, vkCmdSetPrimitiveTopology, vkCmdSetPrimitiveRestartEnable). On 1.2 they come from VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state2, with the same enum values and signatures.

  • Vulkan13Features (from runtime: accept a Vulkan 1.2 device with VK_KHR_dynamic_rendering and VK_KHR_synchronization2 #1706) queries both EXT feature structs on a 1.2 device and, where the device has both, enables them and adds the two extensions (extended_dynamic_state). On 1.3 they are core and nothing changes.
  • device_proc_or_khr tries the core name, then the KHR name, then the EXT name.
  • Without the extensions a 1.2 device still works for compute, and graphics pipelines are refused as before. The 1.2 startup line says which case applies.

Tested

Cross-built with clang-cl 22.1.8 + lld + xwin, run under CrossOver Preview 20260821 (arm64 Wine + FEX, MoltenVK 1.2.10) on an Apple M2 Max, full ctest (107 tests) compared with #1706 at the same commit:

  • No regressions.
  • Default MoltenVK settings: d3d12_subgroup now passes.
  • With MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=1 (MoltenVK 1.2.x has Metal argument buffers off by default; the bindless set needs them): d3d12_m2_textured, d3d12_m3_frame, d3d12_set0_compute and d3d12_subgroup now pass.
  • d3d12_draw passes too once TEST-266 (fix(test): use monotonic fence value (31) for bundle blend pass in d3d12_draw_test #1807) is applied; on main it fails everywhere for that reason.
  • Still failing on this driver, not changed here: d3d12_descriptor and d3d12_r9g9b9e5_uav (bindless set larger than MoltenVK 1.2.10 can place in an argument buffer), the occlusion tests (also fail with that MoltenVK natively), and the Mac/Wine items others own (D3D-245, D3D-246, D3D-165).
  • Not run on a 1.3 device; on 1.3 the chain, the extensions and the loaded functions are unchanged.

Checklist

  • 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. (Not applicable: no translator rule.)

AI-assisted. No game files.

…ended_dynamic_state(2)

The graphics pipelines use the Vulkan 1.3 core dynamic states (primitive topology, primitive restart, vertex
binding stride) and their commands (vkCmdBindVertexBuffers2, vkCmdSetPrimitiveTopology,
vkCmdSetPrimitiveRestartEnable). On a Vulkan 1.2 device these come from VK_EXT_extended_dynamic_state and
VK_EXT_extended_dynamic_state2, with the same values and signatures. Vulkan13Features now enables both where
the device has them, and device_proc_or_khr also tries the EXT name. Without them a 1.2 device still works for
compute, and graphics pipelines are refused as before.

AI-assisted. No game files.

@Serrambi Serrambi 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 15901c66 and tested on NVIDIA GeForce RTX 5070 Ti (Vulkan 1.3, driver 610.88, Windows 11 Pro, MSVC 19.50.35719.0, Vulkan SDK 1.4.363.0): approve.

Code review (runtime/src/vulkan13_features.h, runtime/src/vulkan_backend.h, runtime/shims/d3d12_vulkan_device.cpp, runtime/test/vk_test_device.h)

  • Vulkan13Features cleanly handles physical-device selection, feature enabling (enable() / next()), and extension registration for Vulkan 1.3 (core == true) as well as Vulkan 1.2 + VK_KHR_dynamic_rendering + VK_KHR_synchronization2.
  • Requiring both VK_EXT_extended_dynamic_state and VK_EXT_extended_dynamic_state2 (extended_dynamic_state) accurately matches the entry points checked in VulkanDeviceFunctions::graphics_complete() (vkCmdBindVertexBuffers2, vkCmdSetPrimitiveTopology, and vkCmdSetPrimitiveRestartEnable), while keeping compute-only devices usable without them.
  • device_proc_or_khr() tries core → KHR → EXT cleanly in both VulkanDeviceFunctions::load() and vktest::Device::fn().
  • Note: RTX 5070 Ti exercises the Vulkan 1.3 (core == true) path at runtime; the Vulkan 1.2 KHR/EXT fallback path was verified by code inspection.

Checks on 15901c66

  • ctest --test-dir runtime/build --output-on-failure -R "^(vk_command_replay|d3d12_draw|d3d12_compute|d3d12_vulkan_device|d3d12_translated_draw|d3d12_m2_textured|d3d12_m3_frame|d3d12_subgroup)$" (default): 7/7 passed (d3d12_vulkan_device, d3d12_translated_draw, d3d12_m2_textured, d3d12_m3_frame, d3d12_compute, d3d12_draw, d3d12_subgroup).
  • Same ctest subset under LEONIDA_VK_VALIDATION=1: 6/7 passed with 0 validation errors (only d3d12_draw failed on the pre-existing fence signal 21 is not above 30 / VUID-vkDestroyPipeline-pipeline-00765 issue from main).

@JavierBlanco23

Copy link
Copy Markdown
Contributor

Tested 15901c66 on NVIDIA GeForce RTX 5080, driver 616.56, Windows 11 (MSVC 19.44, Ninja): fail (108/109 executed ctest tests passed; 7 skipped, 1 disabled).

  • Failed: 98 - d3d12_draw: bundle blend pixel (0, 0): got 127,0,127,255, expected red 64
  • Control on the same machine/driver: d3d12_draw_test.exe passes on upstream/main (4eb6155d). Note that 15901c66 is based on an older main, so rebasing/merging current main may clarify whether the bundle blend failure comes from the base or the PR changes.

@ezwinxdlmao

Copy link
Copy Markdown
Contributor

Tested 15901c6 on an NVIDIA GeForce RTX 3050 Laptop GPU, driver 32.0.16.2101, Windows 11, native MSVC (VS 2022 Build Tools, Ninja, RelWithDebInfo), with llvm-mc 21.1.8: pass, as a no-regression check on a Vulkan 1.3 device.

  • Full ctest -j3: 115/116. The one failure is d3d12_draw (bundle blend pixel 127,0,127,255; TEST-266), which fails identically on unmodified main 4eb6155d on the same GPU.
  • With LEONIDA_VK_VALIDATION=1, d3d12_m3_frame_test and d3d12_translated_draw_test both exit 0, so graphics pipelines are still validation-clean on the 1.3 path.
  • Not covered: this device reports Vulkan 1.3, so the new VK_EXT_extended_dynamic_state(2) path for 1.2 devices doesn't run here, and the PR has no switch to force it. That still needs a 1.2 driver, such as MoltenVK as in the PR's own run.

AI-assisted (Claude Code).

@packwka22

Copy link
Copy Markdown

Tested 15901c66 on RTX 4060 Laptop (Windows): pass

No regressions on a Vulkan 1.3+ device, and no new validation messages. This covers the case the description lists as not run ("Not run on a 1.3 device"): the core path, not the new 1.2 EXT path.

Setup
Commit 15901c66 (main 4eb6155d merged in)
GPU NVIDIA GeForce RTX 4060 Laptop GPU
Driver 617.42, Vulkan 1.4.351
OS Windows 11 Pro 26300
Build MSVC (VS 2022 Build Tools) + Ninja, RelWithDebInfo
Vulkan SDK 1.4.363.1
Device pinning VK_LOADER_DRIVERS_SELECT=nv-vk*, LEONIDA_VK_DEVICE=4060, LEONIDA_HOST_ADAPTER=4060, VK_LOADER_LAYERS_DISABLE=~implicit~
Game files None

Results

Full ctest, run twice: without validation, and with LEONIDA_VK_VALIDATION=1.

Run Passed Failed Skipped / disabled
No validation 102 1 8
LEONIDA_VK_VALIDATION=1 103 1 7

vk_sync_validation passes with validation on, so synchronization validation is active.

The one failure: d3d12_draw, not caused by this PR

bundle blend pixel (0, 0): got 127,0,127,255, expected red 64

With validation it also reports VUID-vkDestroyPipeline-pipeline-00765 (a pipeline destroyed while still in use). That is the only validation message in the whole run.

Build d3d12_draw VUID-00765
main 4eb6155d fails, 3/3 runs yes
this PR fails, 3/3 runs yes
this PR + #1995 passes, 3/3 runs no

The failure is #1966, and #1995 fixes it.

Skipped

  • shader_library_corpus, bink_decode, bink_audio, fsr_dispatch, bvh_builder: need the package (LEONIDA_GAME_DIR not set).
  • d3d12_rgb9e5_rtv: "RGB9E5 render targets unavailable on this adapter".
  • gameinput: disabled (built without SDL3).

@XFlawless1

Copy link
Copy Markdown
Contributor

Tested 3db0860 natively on Windows with NVIDIA and AMD: pass, no regressions on Vulkan 1.3+ drivers. This is the "on 1.3 nothing changes" side; the 1.2 EXT path isn't exercised here.

Setup: Windows 11 Pro 10.0.26300, MSVC 19.44.35230 (VS 2022 Build Tools), Vulkan SDK 1.4.363.0, scripts/build_runtime.ps1 (Ninja, RelWithDebInfo). Two GPUs, each selected with LEONIDA_VK_DEVICE:

  • NVIDIA GeForce RTX 5080, driver 621.14 (Vulkan 1.4.357)
  • AMD Radeon iGPU, Ryzen 7 9800X3D (RDNA2, 0x13C0), driver 32.0.21042.62 (Vulkan 1.4.315)

VK_LOADER_LAYERS_DISABLE=~implicit~. Full ctest -j1, with this PR merged onto main 6a6704df, compared with 6a6704df alone on the same PC. The PR's base is 003e7812; merged onto 6a6704df with no conflicts.

AI-assisted (Claude Code).

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 3db0860, merged onto main 4eb6155 (no conflicts), on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, fresh RelWithDebInfo build:

  • Graphics tests: d3d12_vulkan_device, d3d12_translated_draw, d3d12_m2_textured and d3d12_m3_frame pass 20 of 20 runs. They also pass under LEONIDA_VK_VALIDATION=1, with 0 validation messages from them.
  • Full ctest: 116/117. The one failure, d3d12_draw, also fails on main 4eb6155 without this PR (fence signal 21 is not above 30; fix(test): use monotonic fence value (31) for bundle blend pass in d3d12_draw_test #1807). Its validation message (VUID-vkDestroyPipeline-pipeline-00765) is the same one main gives.

This card is a Vulkan 1.4 device, so this covers the core path (extended_dynamic_state = true, no extensions added); it doesn't exercise the 1.2 path the PR is for. Reading the 1.2 path: enable() chains rendering → sync2 → eds → eds2 → the caller's chain, and next() returns &eds2_.pNext in that case. So structs inserted later still land after both new ones.

AI-assisted (Claude Code).

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@ItsNotRexed
ItsNotRexed merged commit 7d867d0 into ItsNotRexed:main Nov 22, 2026
10 of 11 checks passed
itsRevela added a commit to itsRevela/Leonida that referenced this pull request Nov 22, 2026
…OC-155 review)

CrossOver on arm64 (FEX) or x86-64 (Rosetta), from merged ItsNotRexed#1706, ItsNotRexed#1707 and
ItsNotRexed#1924, with ItsNotRexed#3119 open for the last loader tests; suggested in review.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants