mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 17:48:40 +00:00
Windows 10's own Direct3D 12 stops at shader model 6.5 and refuses the heap-directly-indexed root signatures every translated pipeline uses, so on Windows 10 leonida.exe made no host pipeline at all. leonida.exe now exports D3D12SDKVersion and D3D12SDKPath (.\D3D12\), so Windows loads Microsoft's newer runtime from a D3D12 folder beside it. D3D12SDKVersion is set first thing in main to the version of the D3D12Core.dll that is there (a mismatch makes Windows refuse Direct3D 12, 0x887E0003), or to Windows' own runtime's without one, so nothing changes on Windows 11. d3d12.dll is delay-loaded so that Windows reads the version main set. Get-D3D12.cmd (scripts\get-d3d12.ps1) fetches Agility SDK 1.614.1 from nuget.org with pinned SHA-256s and a Microsoft signature check, and play-nvidia.ps1 stops with that hint on Windows 10 without the folder. Ported from trustno1-coder/VIctory-NVIDIA (GPL-3.0-or-later), commits 10862a6, e69e39c, f3534e6 and 0f0ada1 there. Tested on Windows 10 Pro 22H2 (19045), RTX 3090, driver 610.88, Ryzen 7 9800X3D: `leonida warm --used --again --limit 30` made 30 of 30 host pipelines with D3D12\D3D12Core.dll (1.620) beside the exe, and 30 of 30 had no host pipeline without it. New tests: agility::tests (version and export parsing, Windows' own runtime: it exports D3D12SDKVersion 2 on Windows 10 22H2) and tests/agility.rs (the exe exports both symbols; d3d12.dll is delay-loaded, not imported). Written with AI assistance (Claude). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.9 KiB
Rust
60 lines
1.9 KiB
Rust
//! `leonida.exe` asks Windows for Microsoft's newer Direct3D 12 runtime
|
|
//! (the D3D12 Agility SDK) beside it: Windows reads `D3D12SDKVersion` and
|
|
//! `D3D12SDKPath` from the executable's exports, and reads them when
|
|
//! `d3d12.dll` is loaded, so that DLL is delay-loaded (src/agility.rs,
|
|
//! build.rs). Without the exports Windows 10 keeps its own runtime, which
|
|
//! stops at shader model 6.5 and refuses every translated pipeline.
|
|
#![cfg(all(windows, target_env = "msvc"))]
|
|
|
|
use std::process::Command;
|
|
|
|
/// `leonida inspect <leonida.exe> <flag>`'s output.
|
|
fn inspect_self(flag: &str) -> String {
|
|
let exe = env!("CARGO_BIN_EXE_leonida");
|
|
let output = Command::new(exe)
|
|
.args(["inspect", exe, flag])
|
|
.output()
|
|
.unwrap();
|
|
assert!(
|
|
output.status.success(),
|
|
"inspect failed: {}",
|
|
String::from_utf8_lossy(&output.stderr)
|
|
);
|
|
String::from_utf8_lossy(&output.stdout).into_owned()
|
|
}
|
|
|
|
#[test]
|
|
fn the_exe_exports_the_agility_sdk_symbols() {
|
|
let stdout = inspect_self("--exports");
|
|
for name in ["D3D12SDKVersion", "D3D12SDKPath"] {
|
|
assert!(
|
|
stdout
|
|
.lines()
|
|
.any(|line| line.split_whitespace().nth(1) == Some(name)),
|
|
"{name} is not exported:\n{stdout}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn d3d12_dll_is_delay_loaded() {
|
|
let stdout = inspect_self("--imports");
|
|
let (plain, delayed) = stdout
|
|
.split_once("delay-load imports")
|
|
.unwrap_or((&stdout, ""));
|
|
let names = |part: &str| -> Vec<String> {
|
|
part.lines()
|
|
.filter_map(|line| line.split_whitespace().next())
|
|
.map(str::to_ascii_lowercase)
|
|
.collect()
|
|
};
|
|
assert!(
|
|
!names(plain).iter().any(|dll| dll == "d3d12.dll"),
|
|
"d3d12.dll is imported before main runs:\n{stdout}"
|
|
);
|
|
assert!(
|
|
names(delayed).iter().any(|dll| dll == "d3d12.dll"),
|
|
"d3d12.dll is not delay-loaded:\n{stdout}"
|
|
);
|
|
}
|