Load d3d12.dll on first use so the D3D12SDKVersion set in main is the one Windows reads
Windows reads victory.exe's D3D12SDKVersion export when d3d12.dll is loaded. As a static import, it was loaded before main, so match_d3d12_core's value never took effect and v2026.11.27.4 and .5 always asked for 614 (0x887E0003 on Windows 10 and Windows 11 22H2/23H2 without a D3D12 folder, issue #271, and with a 1.618/1.620 folder). A copy of .5 whose export starts at 9999 fails the shader-model check here even though main sets 4 first; with /DELAYLOAD:d3d12.dll it passes. Without a folder, ask for Windows' own runtime's version (the D3D12SDKVersion System32's D3D12Core.dll exports, at most 614) instead of 4: once 4 was really read, Windows turned off later features and muted runs held 14 fps with a white window. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f3534e6b09
commit
0f0ada1909
2 files changed
+76
-6
No files matched your search
@@ -2,9 +2,16 @@
|
||||
//! Direct3D 12 reads them from the process's executable to load Microsoft's
|
||||
//! newer runtime from `D3D12\` beside it. An executable exports nothing by
|
||||
//! itself, so the linker is told to.
|
||||
//!
|
||||
//! Direct3D 12 reads `D3D12SDKVersion` when `d3d12.dll` is loaded. Imported the
|
||||
//! usual way, it is loaded before `main` runs, so the version `main` sets from
|
||||
//! the `D3D12` folder (or Windows' own, without one) came too late and every
|
||||
//! start asked for 614. Loaded on its first use instead, it reads that version.
|
||||
fn main() {
|
||||
if std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {
|
||||
println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKVersion,DATA");
|
||||
println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKPath,DATA");
|
||||
println!("cargo:rustc-link-arg-bins=/DELAYLOAD:d3d12.dll");
|
||||
println!("cargo:rustc-link-arg-bins=delayimp.lib");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user