d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it #51

Open
github-bot wants to merge 1 commit from github-bot/gh-51 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:07 UTC · original
ubiquitarianism:old-pr/9773 → main · +41 −2 · 4 files · 1 commits · draft

Carried over from old PR 9773 by Joaco9020 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9773, 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.
Joaco9020: 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):

Finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115210531 (by @evilclanker9000; claimed as soon as the board accepted comments again)

Depends on: none.

What and why

The translator records needs_maintenance8: true for shaders that sample with a texel offset outside a gather (the SPIR-V Offset image operand, tools/rdna2spirv.py), which is valid only with VK_KHR_maintenance8. The runtime never read the field (runtime/src/shader_library.h, ShaderEntry / load()), so on a device without the extension such a pipeline went to the driver as an invalid module instead of being refused with a reason. VulkanDeviceInfo::maintenance8 already says whether the device enabled it.

  • shader_library.h: ShaderEntry::needs_maintenance8, read from the index like uses_code_base (absent or not a boolean: false).
  • d3d12_vulkan_device.cpp: graphics (per stage) and compute pipeline creation refuse such a shader with E_NOTIMPL and one line naming it, beside the existing mesh-limit and workgroup-memory refusals.

Tested

Windows 11, NVIDIA GeForce RTX 3070, driver 621.01, MSVC 19.44 (VS 2022 Build Tools), Vulkan SDK 1.4.363.1, on main 5d74c2723:

  • shader_library_test: OK, with a new check that the flag is read and defaults to false.
  • d3d12_mesh_test: OK. Its every-GPU block (the device it builds leaves maintenance8 off) now also creates a VS + PS pipeline whose PS entry has needs_maintenance8: true (refused, E_NOTIMPL, logs ps_offset samples with a texel offset; the device has no VK_KHR_maintenance8) and the same pipeline with the unflagged PS (created).
  • Negative control: the new test against the old d3d12_vulkan_device.cpp fails at the refusal check (the pipeline is created).
  • Full ctest -C RelWithDebInfo: 256/262; the 6 failures are the same without this change (d3d12_vulkan_device #7125, d3d12_execute_indirect_validation #9002, d3d12_indirect_rt #6010, d3d12_depth_resolve, d3d12_bindless_churn_validated under -j #6221, and d3d12_pso_validation's DYNAMIC_DEPTH_BIAS parity on NVIDIA, which fails identically on the unchanged layer).

No game files.

AI-assisted: yes (Claude).

🤖 Generated with Claude Code

**@⁠Andretuta** on GitHub · 2026-11-24 02:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/51) `ubiquitarianism:old-pr/9773` → `main` · +41 −2 · 4 files · 1 commits · draft > Carried over from **old PR 9773** by `Joaco9020` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9773`, 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. > `Joaco9020`: 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): Finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115210531 (by `@evilclanker9000`; claimed as soon as the board accepted comments again) Depends on: none. ### What and why The translator records `needs_maintenance8: true` for shaders that sample with a texel offset outside a gather (the SPIR-V `Offset` image operand, `tools/rdna2spirv.py`), which is valid only with `VK_KHR_maintenance8`. The runtime never read the field (`runtime/src/shader_library.h`, `ShaderEntry` / `load()`), so on a device without the extension such a pipeline went to the driver as an invalid module instead of being refused with a reason. `VulkanDeviceInfo::maintenance8` already says whether the device enabled it. - `shader_library.h`: `ShaderEntry::needs_maintenance8`, read from the index like `uses_code_base` (absent or not a boolean: false). - `d3d12_vulkan_device.cpp`: graphics (per stage) and compute pipeline creation refuse such a shader with `E_NOTIMPL` and one line naming it, beside the existing mesh-limit and workgroup-memory refusals. ### Tested Windows 11, **NVIDIA GeForce RTX 3070**, driver 621.01, MSVC 19.44 (VS 2022 Build Tools), Vulkan SDK 1.4.363.1, on `main` `5d74c2723`: - `shader_library_test`: OK, with a new check that the flag is read and defaults to false. - `d3d12_mesh_test`: OK. Its every-GPU block (the device it builds leaves `maintenance8` off) now also creates a VS + PS pipeline whose PS entry has `needs_maintenance8: true` (refused, `E_NOTIMPL`, logs `ps_offset samples with a texel offset; the device has no VK_KHR_maintenance8`) and the same pipeline with the unflagged PS (created). - **Negative control**: the new test against the old `d3d12_vulkan_device.cpp` fails at the refusal check (the pipeline is created). - Full `ctest -C RelWithDebInfo`: 256/262; the 6 failures are the same without this change (`d3d12_vulkan_device` `#7125`, `d3d12_execute_indirect_validation` `#9002`, `d3d12_indirect_rt` `#6010`, `d3d12_depth_resolve`, `d3d12_bindless_churn_validated` under `-j` `#6221`, and `d3d12_pso_validation`'s `DYNAMIC_DEPTH_BIAS` parity on NVIDIA, which fails identically on the unchanged layer). No game files. AI-assisted: yes (Claude). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The translator records needs_maintenance8 for shaders that sample with a texel
offset outside a gather (the SPIR-V Offset image operand), but the runtime never
read it: on a device without VK_KHR_maintenance8 such a pipeline went to the
driver as invalid SPIR-V. ShaderLibrary::load() now reads the flag, and graphics
and compute pipeline creation refuse such a shader with E_NOTIMPL and a reason,
as they already do for mesh limits and workgroup memory.

Finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7115210531

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:42:22 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/src/shader_library.h
  • runtime/test/d3d12_mesh_test.cpp
  • runtime/test/shader_library_test.cpp
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/51/head:github-bot/gh-51'
git switch 'github-bot/gh-51'

Merge

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