GPU: use the DirectX Agility SDK when the system D3D12 runtime refuses the shaders' root signatures #2429

Open
github-bot wants to merge 5 commits from github-bot/gh-2429 into main AGit
Owner

@⁠wkdwilliams on GitHub · 2026-11-25 13:21 UTC · original
wkdwilliams:gpu/agility-sdk-fallback → main · +280 −22 · 7 files · 5 commits · open

Problem

On Windows 10 (22H2, in-box d3d12.dll 10.0.19041), no host pipeline can be built. The translated shaders use root signatures with the shader model 6.6 flags CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED and SAMPLER_HEAP_DIRECTLY_INDEXED, and the system runtime rejects them with Unsupported bit-flag set (root signature flags c01).

translate --cache --pipelines then makes 0 pipelines (27,059 of 27,160 skipped as "the host refuses it"), and run can't create pipelines either.

Change

New victory-shader::d3d12_runtime chooses the runtime once, at first use:

  1. It serializes a probe root signature (no parameters, the two flags) on the system runtime. If that works, the system runtime is used and nothing else is loaded.
  2. If it fails and D3D12\D3D12Core.dll (Agility SDK 1.620.x, from the Microsoft.Direct3D.D3D12 NuGet package) is next to victory.exe, devices and root-signature serialization go through an ID3D12DeviceFactory for that runtime.
  3. If it fails and the DLL is missing, the system runtime stays in use and the log says what to add and where.

All host device creation and root-signature serialization now go through this module (victory-gpu host.rs and pipeline/host.rs; victory-shader emit/host.rs). The first host log line says which runtime is in use. The README gets a short Windows 10 section.

No Microsoft binary is added to the repo; the DLL is user-supplied, like the game files.

What should not change

On a runtime that accepts the flags (the Windows 11 case), the calls are the same D3D12CreateDevice and D3D12SerializeVersionedRootSignature as before. The only differences are one extra startup serialization (the probe) and one log line.

Tested

Windows 10 22H2, RTX 4060 Ti:

  • DLL present: the log says DirectX Agility SDK 620 from ...\D3D12\, and pipelines build or load from the library.
  • DLL absent: the log says what to download, and a host device is still created (no hard failure).
  • cargo clippy --workspace --all-targets is clean. cargo test --workspace --no-fail-fast: all pass except 3 victory-gpu tests (descriptor::host::tests::dynamic_slots_are_held_until_released, draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view, memory::tests::lists_share_a_table_and_copies_keep_their_views). They fail identically on the base commit, so they are not from this change.

Not tested: Windows 11

The author has no Windows 11 machine. Request to a Windows 11 tester: build this branch with no D3D12 folder and check that the first victory_gpu::host log line reads Direct3D 12 runtime of Windows: the runtime in Windows accepts the root signature flags, and that behaviour is unchanged from main.

Not in scope

On this NVIDIA GPU the host view heap is capped at 1,000,000 descriptors and the title asks for more, which produces title slot past the host heap warnings and is a separate issue from this one.

**@⁠wkdwilliams** on GitHub · 2026-11-25 13:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2429) `wkdwilliams:gpu/agility-sdk-fallback` → `main` · +280 −22 · 7 files · 5 commits · open **Problem** On Windows 10 (22H2, in-box `d3d12.dll` 10.0.19041), no host pipeline can be built. The translated shaders use root signatures with the shader model 6.6 flags `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` and `SAMPLER_HEAP_DIRECTLY_INDEXED`, and the system runtime rejects them with `Unsupported bit-flag set (root signature flags c01)`. `translate --cache --pipelines` then makes 0 pipelines (27,059 of 27,160 skipped as "the host refuses it"), and `run` can't create pipelines either. **Change** New `victory-shader::d3d12_runtime` chooses the runtime once, at first use: 1. It serializes a probe root signature (no parameters, the two flags) on the system runtime. If that works, the system runtime is used and nothing else is loaded. 2. If it fails and `D3D12\D3D12Core.dll` (Agility SDK 1.620.x, from the `Microsoft.Direct3D.D3D12` NuGet package) is next to `victory.exe`, devices and root-signature serialization go through an `ID3D12DeviceFactory` for that runtime. 3. If it fails and the DLL is missing, the system runtime stays in use and the log says what to add and where. All host device creation and root-signature serialization now go through this module (`victory-gpu` `host.rs` and `pipeline/host.rs`; `victory-shader` `emit/host.rs`). The first host log line says which runtime is in use. The README gets a short Windows 10 section. No Microsoft binary is added to the repo; the DLL is user-supplied, like the game files. **What should not change** On a runtime that accepts the flags (the Windows 11 case), the calls are the same `D3D12CreateDevice` and `D3D12SerializeVersionedRootSignature` as before. The only differences are one extra startup serialization (the probe) and one log line. **Tested** Windows 10 22H2, RTX 4060 Ti: - DLL present: the log says `DirectX Agility SDK 620 from ...\D3D12\`, and pipelines build or load from the library. - DLL absent: the log says what to download, and a host device is still created (no hard failure). - `cargo clippy --workspace --all-targets` is clean. `cargo test --workspace --no-fail-fast`: all pass except 3 `victory-gpu` tests (`descriptor::host::tests::dynamic_slots_are_held_until_released`, `draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view`, `memory::tests::lists_share_a_table_and_copies_keep_their_views`). They fail identically on the base commit, so they are not from this change. **Not tested: Windows 11** The author has no Windows 11 machine. **Request to a Windows 11 tester:** build this branch with no `D3D12` folder and check that the first `victory_gpu::host` log line reads `Direct3D 12 runtime of Windows: the runtime in Windows accepts the root signature flags`, and that behaviour is unchanged from `main`. **Not in scope** On this NVIDIA GPU the host view heap is capped at 1,000,000 descriptors and the title asks for more, which produces `title slot past the host heap` warnings and is a separate issue from this one.
The translated shaders need root signatures with the shader model 6.6
directly indexed heap flags. The runtime in Windows 10 rejects them, so no
host pipeline can be made. Host devices and root signatures now go through
one module that keeps the runtime in Windows when it accepts the flags and
otherwise uses D3D12\D3D12Core.dll next to the executable, if present.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The title's own D3D12SerializeRootSignature calls went to the d3d12.dll in
System32 by name. Where that runtime refuses the shader model 6.6 flags
(Windows 10), every one of the title's signatures failed (26,757 in a run),
the title kept null objects and crashed. They now go through the runtime the
host chose, only when that is the Agility one; the other path is unchanged.
A failed serialization is logged with its flags.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Conflicts in crates/victory-gpu/src/host.rs (imports) and crates/victory-shader/src/emit/host.rs
(main moved device creation into create_device(warp), now made on the chosen D3D12 runtime).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The Windows 10 paragraph had \n, \b and \r read as escapes in the paths.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Main moved on (the depth bounds test, #158): keep the device made on the chosen runtime and
add main's depth bounds support query after it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:05:31 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 13:44 UTC · original

Verified on Windows 10 (in-box d3d12.dll, GTX 1050 / Pascal — the weak end of the affected range), worktree at 3da6782:

  • D3D12Core.dll (NuGet Microsoft.Direct3D.D3D12 1.620.x) staged at target/debug/deps/D3D12/ (next to the test binaries, where current_exe() looks).
  • cargo test -p victory-shader --locked: 244 passed, 3 failed — baseline on this machine without the DLL is 74 failed (the whole SM 6.6 suite skipping-then-panicking). The probe/refuse/factory path works end to end.
  • The 3 remaining failures (a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, gathers_at_a_level_match_the_hardware) are real Pascal hardware output, identical to what an export-based Agility run produces here — not related to this change.

Design notes:

  • Routing through ID3D12DeviceFactory is strictly better than the D3D12SDKPath/D3D12SDKVersion export approach (open PRs #463, #486, #969): it needs no export symbols, so it covers test binaries, benches, and the app uniformly, and Rust can't emit those exports from .drectve anyway (rustc only forwards /DEFAULTLIB: directives).
  • uses_agility() gating the title-facing d3d12_xs! serializers is necessary and right — the title's signatures carry the same flags the system runtime refuses.
  • The cfg(all(windows, any(test, feature = "host"))) gate matches both consumers (victory-gpu and victory enable host; tests get it via test).

One follow-up to consider (not blocking): an xtask step that fetches the NuGet package and stages D3D12Core.dll next to dev/test binaries, as #84 suggested — right now each developer/test run needs the manual copy.

**@⁠kotekompotek** on GitHub · 2026-11-25 13:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2429#issuecomment-7164213606) Verified on Windows 10 (in-box `d3d12.dll`, GTX 1050 / Pascal — the weak end of the affected range), worktree at `3da6782`: - `D3D12Core.dll` (NuGet `Microsoft.Direct3D.D3D12` 1.620.x) staged at `target/debug/deps/D3D12/` (next to the test binaries, where `current_exe()` looks). - `cargo test -p victory-shader --locked`: **244 passed, 3 failed** — baseline on this machine without the DLL is 74 failed (the whole SM 6.6 suite skipping-then-panicking). The probe/refuse/factory path works end to end. - The 3 remaining failures (`a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`, `gathers_at_a_level_match_the_hardware`) are real Pascal hardware output, identical to what an export-based Agility run produces here — not related to this change. Design notes: - Routing through `ID3D12DeviceFactory` is strictly better than the `D3D12SDKPath`/`D3D12SDKVersion` export approach (open PRs #463, #486, #969): it needs no export symbols, so it covers test binaries, benches, and the app uniformly, and Rust can't emit those exports from `.drectve` anyway (rustc only forwards `/DEFAULTLIB:` directives). - `uses_agility()` gating the title-facing `d3d12_xs!` serializers is necessary and right — the title's signatures carry the same flags the system runtime refuses. - The `cfg(all(windows, any(test, feature = "host")))` gate matches both consumers (`victory-gpu` and `victory` enable `host`; tests get it via `test`). One follow-up to consider (not blocking): an `xtask` step that fetches the NuGet package and stages `D3D12Core.dll` next to dev/test binaries, as #84 suggested — right now each developer/test run needs the manual copy.
Author
Owner

@⁠wkdwilliams on GitHub · 2026-11-25 15:13 UTC · original

Thanks for the verifications, and fair point on the overlap: this is the same Agility story as #2360, #2383, #2460 and the earlier #2393 (which I opened and closed; it is the same work), and I did not search for existing PRs before opening it. Please converge on whichever implementation the maintainers prefer.

In case it helps that decision, one piece here may be missing from the others: the title's own root-signature serialization (root.rs, D3D12SerializeRootSignature / D3D12SerializeVersionedRootSignature) is routed through the same runtime, but only when the Agility runtime is in use. Without it, on Windows 10 every one of the title's signatures with the shader model 6.6 flags (0xc00, 0x401) fails (26,757 in one run), the title keeps null objects and crashes in its own code about 35 s in. With it the title ran to its sign-in screen and through loading at 30 fps on an RTX 4060 Ti under Windows 10 (together with format fixes that live in other PRs). It is the second commit here (3da6782), so it can be lifted into another PR on its own.

**@⁠wkdwilliams** on GitHub · 2026-11-25 15:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2429#issuecomment-7166506820) Thanks for the verifications, and fair point on the overlap: this is the same Agility story as #2360, #2383, #2460 and the earlier #2393 (which I opened and closed; it is the same work), and I did not search for existing PRs before opening it. Please converge on whichever implementation the maintainers prefer. In case it helps that decision, one piece here may be missing from the others: the title's own root-signature serialization (`root.rs`, `D3D12SerializeRootSignature` / `D3D12SerializeVersionedRootSignature`) is routed through the same runtime, but only when the Agility runtime is in use. Without it, on Windows 10 every one of the title's signatures with the shader model 6.6 flags (`0xc00`, `0x401`) fails (26,757 in one run), the title keeps null objects and crashes in its own code about 35 s in. With it the title ran to its sign-in screen and through loading at 30 fps on an RTX 4060 Ti under Windows 10 (together with format fixes that live in other PRs). It is the second commit here (3da6782), so it can be lifted into another PR on its own.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:33 UTC · original · edited 2026-11-26 03:19 UTC

Automated triage for the maintainers.

Verdict: needs work (needs the maintainer's decision). Re-reviewed at c41185f, which now merges cleanly into main, and the README backslashes are fixed. victory_shader::d3d12_runtime loads a user-supplied D3D12Core.dll from D3D12\ through ID3D12DeviceFactory when the system runtime refuses the probe signature. Loading an external runtime DLL needs the maintainer's decision. It is also one of several competing approaches: #2460 uses the D3D12SDKPath export with a build.rs, and #2360 / #2383 cover the same problem. Only one should land.

Still open in the code:

  • D3D12CreateRootSignatureDeserializer in crates/victory-gpu/src/root.rs still goes to the system runtime. Please route it as well, or say why that is safe.
  • In serialize, the 1.0 Desc is wrapped in a VersionedDesc with the title's version argument. If that is ever 1.1, the Agility serializer reads the struct with the wrong layout. Force version 1.0 there.
  • The two new tracing::warn! lines are not rustfmt-formatted.
  • There is still no Windows 11 run showing that the system runtime is chosen and behaviour is unchanged.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2429#issuecomment-7167019681) · edited 2026-11-26 03:19 UTC <!-- victory-triage v1 head=c41185fbd9f275295e4e433efd12f7ad75fdef4e verdict=needs-work at=2026-11-26T03:19:22Z --> Automated triage for the maintainers. **Verdict: needs work (needs the maintainer's decision).** Re-reviewed at `c41185f`, which now merges cleanly into `main`, and the README backslashes are fixed. `victory_shader::d3d12_runtime` loads a user-supplied `D3D12Core.dll` from `D3D12\` through `ID3D12DeviceFactory` when the system runtime refuses the probe signature. Loading an external runtime DLL needs the maintainer's decision. It is also one of several competing approaches: #2460 uses the `D3D12SDKPath` export with a `build.rs`, and #2360 / #2383 cover the same problem. Only one should land. Still open in the code: - `D3D12CreateRootSignatureDeserializer` in `crates/victory-gpu/src/root.rs` still goes to the system runtime. Please route it as well, or say why that is safe. - In `serialize`, the 1.0 `Desc` is wrapped in a `VersionedDesc` with the title's `version` argument. If that is ever 1.1, the Agility serializer reads the struct with the wrong layout. Force version 1.0 there. - The two new `tracing::warn!` lines are not rustfmt-formatted. - There is still no Windows 11 run showing that the system runtime is chosen and behaviour is unchanged. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2429/head:github-bot/gh-2429'
git switch 'github-bot/gh-2429'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2429'
git switch 'github-bot/gh-2429'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2429'
git switch 'github-bot/gh-2429'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2429'
git switch 'main'
git merge --squash 'github-bot/gh-2429'
git switch 'main'
git merge --ff-only 'github-bot/gh-2429'
git switch 'main'
git merge 'github-bot/gh-2429'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2429
No description provided.