[PR #1775] OLD-9773: d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it #1787

Open
opened 2026-11-26 21:18:57 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1775
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: carry/old-9773


📝 Commits (1)

  • 88de45b d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it

📊 Changes

4 files changed (+40 additions, -2 deletions)

View changed files

📝 runtime/shims/d3d12_vulkan_device.cpp (+12 -0)
📝 runtime/src/shader_library.h (+5 -0)
📝 runtime/test/d3d12_mesh_test.cpp (+21 -1)
📝 runtime/test/shader_library_test.cpp (+2 -1)

📄 Description

Claimed in the coordination issue as: OLD-9773 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161566908)

What and why

Carries on old PR 9773 by @Joaco9020 (draft #51, branch old-pr/9773, listed in #17), rebased on current main with the author's commit kept.

The translator writes needs_maintenance8 into index.json for a shader that samples with a texel offset outside a gather (the SPIR-V Offset image operand, valid only with VK_KHR_maintenance8), and vk_pipeline_check already reads it, but the D3D12 layer never did: on a device without the extension such a pipeline went to the driver as invalid SPIR-V. ShaderLibrary now reads the flag into ShaderEntry::needs_maintenance8, and graphics and compute pipeline creation refuse such a shader with E_NOTIMPL and a one-line reason, as they already do for mesh limits and workgroup memory. It is not routed through LEONIDA_STUB_PIPELINES, which is for shaders with no translation.

Rebase notes: shader_library.h keeps main's code_base_known handling and adds the new field and read next to it; shader_library_test.cpp adds "needs_maintenance8": true to main's extended ps_out entry; d3d12_mesh_test.cpp keeps main's DISPATCH_MESH command-signature check and adds the author's refused/created pipeline pair after it.

Tested

  • Linux (portable subset, GCC, no GPU): runtime builds; ctest: 84 of 85 pass or skip, including shader_library (which checks the flag is read, and absent means false). The one failure, vk_xdxr_postbuild_readback, is the no-GPU skip returning 77 without SKIP_RETURN_CODE, the same on main and already fixed by #1418.
  • Windows, RTX 4060 (VS 2022, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0): builds cleanly. ctest -R "d3d12_mesh|shader_library": shader_library and d3d12_mesh pass, shader_library_corpus skips (needs game files). Full ctest -j 6: 385 of 385 passed. Two earlier full runs each had one or two failures in tests this change does not touch, which then passed when run alone: d3d12_multithread ran out of device memory once under -j 6, d3d12_depth_stencil_uav crashed once under -j 3 (3 of 3 passes alone), and xmem_write_watch's commit-charge check failed once (1 of 3 alone; known flaky, claimed as TEST-XMEM-COMMIT-CHECK).

GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro build 26300 (d3d12_mesh_test)

AI-assisted: yes (Claude rebased and tested; the change is Joaco9020's)

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. (n/a: runtime only; the index field is already documented there)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1775 **Author:** [@potatoe0100](https://github.com/potatoe0100) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9773` --- ### 📝 Commits (1) - [`88de45b`](https://github.com/ubiquitarianism/leonida/commit/88de45bf1d76cc2875ae50fa5f2d130d2f0523c9) d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it ### 📊 Changes **4 files changed** (+40 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+12 -0) 📝 `runtime/src/shader_library.h` (+5 -0) 📝 `runtime/test/d3d12_mesh_test.cpp` (+21 -1) 📝 `runtime/test/shader_library_test.cpp` (+2 -1) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9773 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161566908) ### What and why Carries on old PR 9773 by @Joaco9020 (draft #51, branch `old-pr/9773`, listed in #17), rebased on current `main` with the author's commit kept. The translator writes `needs_maintenance8` into `index.json` for a shader that samples with a texel offset outside a gather (the SPIR-V `Offset` image operand, valid only with `VK_KHR_maintenance8`), and `vk_pipeline_check` already reads it, but the D3D12 layer never did: on a device without the extension such a pipeline went to the driver as invalid SPIR-V. `ShaderLibrary` now reads the flag into `ShaderEntry::needs_maintenance8`, and graphics and compute pipeline creation refuse such a shader with `E_NOTIMPL` and a one-line reason, as they already do for mesh limits and workgroup memory. It is not routed through `LEONIDA_STUB_PIPELINES`, which is for shaders with no translation. Rebase notes: `shader_library.h` keeps `main`'s `code_base_known` handling and adds the new field and read next to it; `shader_library_test.cpp` adds `"needs_maintenance8": true` to `main`'s extended `ps_out` entry; `d3d12_mesh_test.cpp` keeps `main`'s DISPATCH_MESH command-signature check and adds the author's refused/created pipeline pair after it. ### Tested - Linux (portable subset, GCC, no GPU): runtime builds; `ctest`: 84 of 85 pass or skip, including `shader_library` (which checks the flag is read, and absent means false). The one failure, `vk_xdxr_postbuild_readback`, is the no-GPU skip returning 77 without `SKIP_RETURN_CODE`, the same on `main` and already fixed by #1418. - Windows, RTX 4060 (VS 2022, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0): builds cleanly. `ctest -R "d3d12_mesh|shader_library"`: `shader_library` and `d3d12_mesh` pass, `shader_library_corpus` skips (needs game files). Full `ctest -j 6`: 385 of 385 passed. Two earlier full runs each had one or two failures in tests this change does not touch, which then passed when run alone: `d3d12_multithread` ran out of device memory once under `-j 6`, `d3d12_depth_stencil_uav` crashed once under `-j 3` (3 of 3 passes alone), and `xmem_write_watch`'s commit-charge check failed once (1 of 3 alone; known flaky, claimed as TEST-XMEM-COMMIT-CHECK). GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro build 26300 (d3d12_mesh_test) AI-assisted: yes (Claude rebased and tested; the change is Joaco9020's) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: runtime only; the index field is already documented there) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1787
No description provided.