d3d12: Windows 10 runs the D3D12 runtime with the Agility SDK (D3D12-RUNTIME-WIN10-AGILITY) #2557
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2557"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-28T03:19:38Z.
Claimed in the coordination issue as: D3D12-RUNTIME-WIN10-AGILITY (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7232979133)
What and why
On Windows 10 the D3D12 runtime (
leonida.exe) makes no host pipeline at all. Windows 10's own Direct3D 12 stops at shader model 6.5 and refuses the heap-directly-indexed root signatures that every translated pipeline uses (shader model 6.6).leonida.exenow exportsD3D12SDKVersionandD3D12SDKPath(.\D3D12\), so Windows loads Microsoft's newer runtime (the D3D12 Agility SDK) from aD3D12folder beside it (apps/leonida/src/agility.rs,apps/leonida/build.rs).D3D12SDKVersionis set first thing inmain:D3D12\D3D12Core.dllthere, to that file's version. A mismatch makes Windows refuse Direct3D 12 altogether (0x887E0003), which is what a fixed version did with other forks' 1.618 and 1.620 folders.D3D12Core.dll), so nothing changes on Windows 11.d3d12.dllis delay-loaded, so Windows reads the versionmainset. Imported the usual way, it is loaded beforemain.Get-D3D12.cmd(scripts/get-d3d12.ps1) fetches Agility SDK 1.614.1 from nuget.org intotarget\diag\D3D12, with pinned SHA-256s and a Microsoft signature check. Nothing is downloaded at play time.scripts/play-nvidia.ps1stops with that hint on Windows 10 when the folder is missing, and the README says so.Ported from trustno1-coder/VIctory-NVIDIA (GPL-3.0-or-later), commits 10862a6, e69e39c, f3534e6 and 0f0ada1 there, where it was measured on Windows 10 22H2 and Windows 11 22H2/25H2.
Tested
leonida warm --used --again --limit 30(a real D3D12 device and 30 host pipelines from a run's pipeline book):D3D12\D3D12Core.dll(1.620) beside the exe: 30 of 30 made;Get-D3D12.cmd.cargo test --profile diag -p leonida --features diagnostics,mimalloc --test agility --bin leonida -- agility d3d12_dll: 5 + 2 passed.agility::testscovers version-resource and export-table parsing, plus Windows' own runtime. On Windows 10 22H2 that runtime exportsD3D12SDKVersion2.tests/agility.rschecks that the exe exports both symbols, and thatd3d12.dllis delay-loaded rather than imported. Both fail onmain.Get-D3D12.cmdfetched and verified the package and DLL (hash and Microsoft signature) into a scratch folder.python -I scripts/check_no_game_data.pyon the changed files: clean.GPUs tested: NVIDIA GeForce RTX 3090, driver 610.88, Windows 10 Pro 22H2 (19045), Ryzen 7 9800X3D
AI-assisted: yes (Claude)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:20:46Z.
Review: APPROVED
Reviewed the diff and tested merged onto
main(493867366) on Windows 11 with Rust 1.100.1 (MSVC).Delay-loading
d3d12.dllviabuild.rs, exportingD3D12SDKVersion(AtomicU32) andD3D12SDKPath, and matching either a localD3D12\D3D12Core.dllversion orSystem32\D3D12Core.dll's exported version befored3d12.dllloads is clean and well-tested;scripts/get-d3d12.ps1verifies pinned SHA-256 hashes and Microsoft Authenticode signature.Tests run
cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida --test agility --bin leonida -- agility d3d12_dll: 5 unit tests + 2 integration tests passed (verifying PE exports,d3d12.dlldelay-load, and reading Windows 11System32\D3D12Core.dll).AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:24:05Z.
VERIFY-2557-D3D12— verified head99bb9dadfemerged cleanly withmainc7f5330e0on Windows 11 Pro (build 26200), NVIDIA GeForce RTX 3090 (driver 610.88), synthetic PE/resource fixtures and host inboxSystem32\D3D12Core.dllinspection only.Red (
mainc7f5330e0) -> Green (c7f5330e0+99bb9dadfe)main:cargo build --manifest-path d3d12/Cargo.toml -p leonida --bin leonida-> PE export directory is empty (exports = []),d3d12.dllis eagerly imported viaIMAGE_DIRECTORY_ENTRY_IMPORT, andIMAGE_DIRECTORY_ENTRY_DELAY_IMPORTis empty.cargo test --manifest-path d3d12/Cargo.toml -p leonida --bin leonida -- agility::tests --test-threads=4-> 5 passed; 0 failed, includingexported_sdk_version_reads_windows_own_runtimeagainst Windows 11 build 26200's inboxSystem32\D3D12Core.dll(readsD3D12SDKVersion = 616, clamped byos_runtime()to614when no side-by-sideD3D12\D3D12Core.dllis present so Windows 11 keeps its newer inbox runtime).cargo build --manifest-path d3d12/Cargo.toml -p leonida --bin leonida-> PE header inspection confirmsIMAGE_DIRECTORY_ENTRY_EXPORTexportsD3D12SDKVersion(initialu32 = 614) andD3D12SDKPath(.\D3D12\),d3d12.dllis absent fromIMAGE_DIRECTORY_ENTRY_IMPORT, andIMAGE_DIRECTORY_ENTRY_DELAY_IMPORTlists['d3d12.dll'].Non-blocking note
exported_sdk_version(d3d12/apps/leonida/src/agility.rs:157),va + size.max(raw_size)andrva - va + rawuse uncheckedu32addition, which could panic in debug/diag builds if a malformed PE image hasva + size > u32::MAX;saturating_add/checked_addwould keep corrupted section headers total (None).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-28T12:13:01Z.
Tested on Pascal / Windows 10. This takes
leonida.exefrom a crash ~11 s in to the title's start screen.Setup
scripts\play-d3d12.ps1 -Game <package> -SeriesS -NoDlss -Log(diag build,build-nvidia.ps1 -NoDlss).mainecceb6728versus this PR99bb9dadf, in the same worktree, with the same shader cache and the same settings.get-d3d12.ps1fetched 1.614.1: the package and DLL hashes matched and the Microsoft signature was valid.cargo test --profile diag -p leonida --features diagnostics,mimalloc --test agility --bin leonida -- agility d3d12_dll: 5 + 2 passed.MEASURED, device caps. A ctypes
CheckFeatureSupportfrom a host process that does not exportD3D12SDKVersionreports:MEASURED,
main, noD3D12folder.root signature: Unsupported bit-flag set (root signature flags c00)/c01, each followed byhost root signature refused(1 graphics, 5 compute).0xc0000005 at <title>+0xb5a5f8 (read 0x68). The process ends.MEASURED, this PR with
target\diag\D3D12\D3D12Core.dll.Unsupported bit-flag, 0 refused root signatures, 0 unhandled exceptions, no device removal.video memory as the system counts it): 1,648 of a 3,403 MB budget in use, flat for the last ~7 minutes.MEASURED, still open on this card, and not this PR's subject:
host mesh shader support mesh=false, sono host pipeline: the host GPU has no mesh shaders. Pascal has no D3D12 mesh shaders, so the world will need a fallback here.host view heap capped at 1000000; views past it read a null slot count=1245184: the view heap is capped at tier 3's 1M.a pipeline creation method that is not implemented(the same kinds as onmain).READ IN CODE
agility.rssets the version from the file beside the exe, or else from System32's runtime.d3d12.dllis delay-loaded, so the value set inmainis the one Windows reads. That matches what we saw: nothing changes without the folder, and SM 6.6 with it.This also answers the Windows 10 hypothesis in my finding (#2570#issuecomment-7238893730): on this machine the 6.5 ceiling was the OS runtime, and this PR lifts it.
GPUs tested: GTX 1050 Ti 4 GB (Pascal, profile S), driver 582.66, Windows 10. No DLSS files.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-28T15:30:36Z.
Thanks for the reviews and the test runs, @zmasi @qhukz13 @lixonik.
dd26534takes zmasi's non-blocking note:exported_sdk_version's section lookup now useschecked_addforva + sizeandrva - va + raw, so a malformed section is skipped (None) instead of overflowing. The new testexported_sdk_version_is_none_for_a_section_past_u32_maxfails before the change with overflow checks on (CARGO_PROFILE_DIAG_OVERFLOW_CHECKS=true: "attempt to add with overflow") and passes after.agility::tests6 passed (Windows 10 22H2, RTX 3090, driver 610.88). Nothing else changed.AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T20:00:35Z.
Review: APPROVED
Re-verified updated head
dd2653445on Windows 11.Code audit:
d3d12/apps/leonida/src/agility.rs:exported_sdk_version()now useschecked_addfor bothva + size.max(raw_size)and(rva - va) + raw, returningNonecleanly on malformed section headers instead of overflowing, covered byexported_sdk_version_is_none_for_a_section_past_u32_max.Verification (Windows 11, Rust debug profile with overflow checks):
cargo test --manifest-path d3d12/Cargo.toml -p leonida agility::tests: 6/6 passed.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T20:19:47Z.
Red/green: On main the agility test fails twice (D3D12SDKVersion not exported, d3d12.dll imported before main), and with the PR cargo test -p leonida --test agility passes with its 6 unit tests on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main
c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:04:58Z.
Verified by OreoFR
54d27d988+ PR headdd2653445; green run in a merge package of 5 PRs, no new ctest failure vs maincargo test -p leonida --test agility --locked (+ agility::tests unit tests)AI-assisted (Claude Code, Claude Opus 5.5).