Skip to content

Windows 10: load the D3D12 Agility SDK runtime for shader model 6.6 - #175

Closed
kykifox1337-source wants to merge 1 commit into
Marvisak:mainfrom
kykifox1337-source:agility-sdk
Closed

kykifox1337-source wants to merge 1 commit into
Marvisak:mainfrom
kykifox1337-source:agility-sdk

Conversation

@kykifox1337-source

Copy link
Copy Markdown

Fixes #84.

What

Windows 10's in-box D3D12 stops at shader model 6.5. It refuses every translated pipeline's root signature (Unsupported bit-flag set (root signature flags c01): the directly indexed CBV/SRV/UAV and sampler heap flags), so nothing draws.

  • apps/victory/src/agility.rs + apps/victory/build.rs: victory.exe exports D3D12SDKVersion = 620 and D3D12SDKPath = ".\D3D12\" (/EXPORT:…,DATA, MSVC only). dumpbin /exports lists both.
  • cargo xtask agility: downloads Microsoft.Direct3D.D3D12 1.620.2 from nuget.org with the system curl, checks it against the SHA-512 nuget.org's catalog publishes, and unpacks D3D12Core.dll and d3d12SDKLayers.dll (for VICTORY_D3D12_DEBUG) into target\{debug,release,diag}\D3D12\. The package is cached in target\agility\. The zip is read with miniz_oxide (already a workspace dependency); sha2 is the one new dependency, used by xtask only.
  • The DLLs never enter the repository (asset policy). Windows 11, or a missing D3D12\ folder, keeps the in-box runtime.
  • victory config reports whether the runtime is beside the executable. The shader model 6.5 error in victory-shader names the command. README: a Windows 10 note and the command under Getting started.
  • Tests: a synthetic zip (stored and deflated entries), and a check that the package's minor version matches D3D12SDKVersion.

Tested

Windows 10 22H2 (19045), i7-8700K, RTX 2070 SUPER, Rust 1.98.1, on main 9aef3d9, release build, real title:

without the runtime with it
host root signatures refused every one 0
draws run on the host 0 of 192 (first 128 frames) 43,008 of 43,008
run access violation at title +0xb5a5f8 (read 0x68) after about 9 s no crash; stopped by my 3-minute timeout at about 4,100 frames (near 30 fps)

The crash without the runtime looks like a consequence of nothing being drawn; I did not chase it further.

  • cargo xtask policy, cargo fmt --check on the changed files, cargo clippy -p victory -p xtask --all-targets: clean (one existing warning in xmem.rs).
  • cargo test -p xtask: passes.

Not related to this change, seen on main here:

  • victory-gpu tests do not compile: mod tests is defined twice in crates/victory-gpu/src/host.rs (lines 252 and 1974).
  • net::only_loopback_is_reachable fails on Windows 10 (WinHttpGetProxySettingsEx); Loader: run on Windows 10 (clear the IAT directory) #44 fixes it.
  • 7 emit::valu_tests fail with "neither hardware nor WARP SM 6.6 device available": test executables do not export the Agility SDK symbols. A follow-up could give them the runtime or skip without an SM 6.6 device.

AI-assisted: written with Claude Code. I ran everything above on my machine.

🤖 Generated with Claude Code

@DaviTostes

Copy link
Copy Markdown

The test target does not compile, so the GPU suite cannot run:

error[E0428]: the name `tests` is defined multiple times
    --> crates/victory-gpu/src/host.rs:1974:1
 252 | mod tests { ... }
1974 | mod tests { ... }

The library builds; only cargo test fails, on every platform. The new test module needs to go into the existing mod tests in host.rs after a rebase (the same failure as #134/#135/#175).

No game data used.

Windows 10's in-box D3D12 stops at shader model 6.5 and refuses root
signatures with the directly indexed heap flags (c01), so every
translated pipeline was refused and nothing drew (Marvisak#84).

victory.exe now exports D3D12SDKVersion (620) and D3D12SDKPath
(.\D3D12\), and `cargo xtask agility` fetches Microsoft.Direct3D.D3D12
1.620.2 from nuget.org, checks its published SHA-512, and puts
D3D12Core.dll and d3d12SDKLayers.dll in target\<profile>\D3D12\. The
DLLs never enter the repository. Windows 11, or a missing folder, keeps
the in-box runtime.

`victory config` reports whether the runtime is in place, and the SM 6.5
error names the command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kykifox1337-source

Copy link
Copy Markdown
Author

Thanks for checking. That error does not come from this PR: it touches nothing in crates/victory-gpu. The second mod tests was already in host.rs on main at 9aef3d9, the commit this branch started from (I listed it under "not related" in the description). #129 fixed it on main.

I rebased onto current main (d2a4bae), now 19aec59. On Windows 10 19045:

  • every test target compiles; cargo test -p victory-gpu: 43 passed, 1 ignored; cargo test -p xtask: 6 passed
  • cargo xtask policy: 154 files ok
  • the only failures in cargo test --workspace are the Windows 10 ones from the description: net::only_loopback_is_reachable (fixed by Loader: run on Windows 10 (clear the IAT directory) #44) and 7 emit::valu_tests that need an SM 6.6 device in the test executable

AI-assisted (Claude Code); I ran the above myself.

@Proudnoob4

Copy link
Copy Markdown

Tested 19aec59 as is (on main d2a4bae) on Windows 10 22H2 (19045), RTX 4080 16 GB, NVIDIA 621.01, diag build. This is the #84 machine.

step result
cargo xtask agility downloaded microsoft.direct3d.d3d12.1.620.2.nupkg from nuget.org, SHA-512 check passed, wrote D3D12Core.dll (4,874,024 B) and d3d12SDKLayers.dll (5,832,504 B) to target\{debug,release,diag}\D3D12\
pinned hash matches the copy of 1.620.2 I fetched separately for #84 (d683ff7f…693032735); the extracted D3D12Core.dll is byte-identical to that copy's
victory config d3d12 sdk : …\target\diag\D3D12\D3D12Core.dll (version 620)
translate <40 containers> --validate --pipelines 36 of 36 emitted, validated and given pipelines (the sample happened to be all mesh programs)
run <title> --execute, one Enter at the profile prompt, 75 s profile prompt, then the story loading art, rendered correctly; no crash; the captured frames follow the same sequence as my earlier build with hand-added exports

One thing that does not hold here is the doc comment in apps/victory/src/agility.rs ("Without the folder, or on a system whose runtime is newer, the in-box one is used"). With target\diag\D3D12 renamed away, victory config correctly prints not beside the executable (needed on Windows 10: cargo xtask agility), but translate then stops at device creation:

Error: The D3D12 SDK version configuration of the host exe is invalid.

That is D3D12_ERROR_INVALID_REDIST (0x887E0003): the runtime does not fall back to the in-box one. nopsled0x saw the same on #84. Microsoft's Agility SDK guide agrees: the in-box D3D12Core.dll is used only "when an OS has a more recent D3D12Core than what a game shipped with", and INVALID_REDIST "means that D3D12Core.dll was not found in the location specified for D3D12SDKPath" (Getting Started with the Agility SDK).

Suggestions:

  1. Correct the comment: without the folder, the in-box runtime is used only if it is version 620 or newer; otherwise D3D12CreateDevice fails.
  2. The README's "Windows 11 needs nothing" holds only where the in-box runtime is already 620 or newer. I can't test Windows 11 here. A Windows 11 tester could check by building this PR without running the xtask and running victory translate <a few containers> --validate --pipelines. If that fails too, every Windows 11 setup that works on main today would need the xtask step once this merges.
  3. Map D3D12_ERROR_INVALID_REDIST from device creation to the hint config already prints (cargo xtask agility), since device creation is where people will hit it.

AI-assisted (Claude Code); I ran everything above on my machine.

@GamingRipperDoc

Copy link
Copy Markdown

Tested 19aec59 as is (on main d2a4bae) on Windows 10 22H2 (19045.7846), AMD RX 9070 XT (driver 32.0.32015.7029), Ryzen 9 9900X, Rust 1.98.1, diag build. First AMD result here; the earlier ones are NVIDIA.

step result
cargo xtask agility SHA-512 check passed; D3D12Core.dll 4,874,024 B (Authenticode: Valid, file version 1.620.2.0), d3d12SDKLayers.dll 5,832,504 B, in target\{debug,release,diag}\D3D12\
dumpbin /exports target\diag\victory.exe D3D12SDKPath, D3D12SDKVersion
victory config d3d12 sdk : …\target\diag\D3D12\D3D12Core.dll (version 620)
cargo xtask policy / cargo test -p xtask 154 files ok / 6 passed
cargo test --workspace --no-fail-fast only the known Windows 10 failures: net::only_loopback_is_reachable (#118) and the 7 emit::valu_tests (no SM 6.6 device in the test executable)
run <title> --execute, no input (first boot), 75 s no crash, no device removal; 2,647 frames presented, 30-50 fps; 0 draws dropped without a host pipeline in every per-second line

Control, same build with target\diag\D3D12 renamed away, run <title> --execute:

  • WARN victory_gpu::host: no host D3D12 device; command lists will not run error=The D3D12 SDK version configuration of the host exe is invalid. (0x887E0003)
  • under 1 s later the title dies: unhandled exception 0xe06d7363 … (C++ .J = 0x887e0003 thrown) in crashes.log, from its own root-signature serialization.

So I see the same no-fallback behaviour Proudnoob4 reported with translate, and under run it is only a warning followed by a crash inside the title. That supports their suggestion 3: when device creation returns D3D12_ERROR_INVALID_REDIST, failing with the cargo xtask agility hint (as config already prints) would turn that crash into a clear message.

No game data in this report.

AI-assisted (Claude Code); everything above was run on my machine.

@blazerTweaks

Copy link
Copy Markdown

Tested on Windows 10 19045 with an RTX 3060 Ti (driver 32.0.16.1714). With the Agility runtime the title gets through the menus and loading and reaches the world.

On the two review points above (no fallback, and the hint for INVALID_REDIST): I opened #467 before I found this PR, and I'm closing it as a duplicate. Two parts of it address those points and could be folded in here (commit):

  • Opt-in exports. The exports are behind a victory feature, agility = []. The statics are #[cfg(feature = "agility")], and build.rs emits the /EXPORT args only when CARGO_FEATURE_AGILITY is set. A default build is then byte-for-byte today's behaviour, so Windows 11 setups that work on main can't regress, whatever their in-box D3D12Core version. Windows 10 builds with --features agility, then runs cargo xtask agility.
  • Error hints at device creation (crates/victory-gpu/src/host.rs):
    • D3D12_ERROR_INVALID_REDIST gets victory.exe asks for the D3D12 Agility SDK (feature agility) but D3D12\D3D12Core.dll is not next to it: run cargo xtask agility.
    • A device that comes up below SM 6.6 gets the host D3D12 runtime lacks shader model 6.6, so nothing will draw; on Windows 10 build victory with --features agility .... Today that case only shows up as a c01 refusal per pipeline and the +0xb5a5f8 crash.

Each case, run on the title:

build result
default ERROR ... lacks shader model 6.6 ... (model 0x65), no exports in the exe
agility, no D3D12\ ERROR ... D3D12\D3D12Core.dll is not next to it: run cargo xtask agility
agility + DLL every pipeline made; 2,108 of 2,108 draws and 288 of 288 dispatches by frame 1024

Happy to rebase these onto this branch as a PR against it if that's easier.

AI-assisted (Claude Code); the runs above were on my machine.

This was referenced Nov 24, 2026
@simplesmenterafael

Copy link
Copy Markdown

Test report for this PR together with #362 (the tests part), on another Windows 10 + NVIDIA machine. Counts only, no title data.

Machine: Windows 10 Pro 22H2 (19045), NVIDIA GeForce RTX 3050 (driver 32.0.16.2124), AMD Ryzen 5 3600, 16 GB. rustc 1.98.1 (48a229cea 2026-09-01).

Before (no Agility runtime): the in-box runtime reports SM 0x65 on the RTX 3050 and SM 0x62 on WARP. cargo test --workspace --locked --no-fail-fast: 474 passed, 22 failed, 7 ignored. All 22 are victory-shader GPU tests failing with no SM 6.6 device available (valu_tests, intersect_tests, waterfall_tests).

After (#362 merged, cargo xtask agility run; package SHA-512 matches the x-ms-meta-SHA512 nuget.org serves): cargo test --workspace --locked --no-fail-fast: 498 passed, 0 failed, 7 ignored. victory-shader: 210 passed, 2 ignored, and no device was skipped (hardware and WARP both ran). Both clippy runs from CI (-D warnings, with and without --all-features) are clean, and cargo xtask policy passes.

Separately, crash::tests::unwinds_like_the_system_walk fails intermittently here too (#742); it is unrelated to this PR.

I have not run the title with this yet.

AI use: run and written with Claude Code (Claude Opus 5.5); the numbers are from real runs on the machine above.

@Calvix2k

Copy link
Copy Markdown
Contributor

Test report: Windows 10 + AMD RDNA3, with the title, stacked on #1798.

Machine: Windows 10 22H2 (19045), Ryzen 7 5800X, Radeon RX 7800 XT (driver 32.0.24027.1012), 32 GB, MSVC x64, Rust 1.98.1.
Build: 19aec59 rebased onto main 70564ae; one conflict in �pps/victory/src/main.rs show_config, resolved by keeping both data_dir/ idelityfx and the d3d12 sdk block. Stacked on #1798 locally, because the title exe and the dump are separate folders here (without it the run stops at TitleID 00000000 before D3D12).

step result
cargo xtask agility SHA-512 check passed; D3D12Core.dll + d3d12SDKLayers.dll written to debug/release/diag\\D3D12
ictory config d3d12 sdk : …\\release\\D3D12\\D3D12Core.dll (version 620)
before (in-box runtime) every translated pipeline refused: Unsupported bit-flag set (root signature flags c01), 0x80070057; drawn=0; crash at +0xb5a5f8 after ~4 s
after (Agility 1.620.2) 0 root-signature refusals, drawn=192/192, dispatched=64/64; the +0xb5a5f8 crash is gone

Series X needs commit headroom; that is not a defect of this PR. On the same machine the Series X profile reaches frame 128 and then stops with mapping physical pages failed (not a placeholder?) … os error 1455 (paging file too small) and a title breakpoint at +0x2474680. C: had 5.4 GB free and the system-managed pagefile could not grow, so the host ran out of commit while creating a 2560x1440 R32G32B32A32 target. The README note about Windows error 1455 covers it; a bigger pagefile (or --console series-s) is the workaround.

Series S is stable. Two runs (60 s and 135 s): 4,096 frames presented, 20,480/20,480 draws and 2,048/2,048 dispatches, no device removal, no crash, 30 fps. The window is still black at that point on upstream – it looks like the loading stage, and is separate from this PR.

Doc nit: the module comment says that without the D3D12 folder the in-box runtime is used. It is not: with the exports present and no folder, device creation fails (INVALID_REDIST). #467's feature gate or a startup hint would address that.

@Calvix2k

Copy link
Copy Markdown
Contributor

Addendum to the AMD result above: on this Windows 10 + RX 7800 XT machine the boot/first-boot screens stay black at 30 fps even with Agility (all draws executed, no warnings, GPU ~2% busy, input changes the UI draw count, standard and separated layouts alike, fresh cache alike). Filed with measurements as #1854 so it does not get mixed into this PR's Windows 10 shader-model fix.

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #463. Windows 10 D3D12 runtime opt-in done with an xtask that downloads a package with curl (new sha2 dependency) and exports that are added even when the runtime folder is missing. #463 (clean) does the opt-in only when the DLL is present and downloads nothing.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

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.

Windows 10: the host device stops at shader model 6.5 (needs the D3D12 Agility SDK)