diff --git a/README.md b/README.md index 4010879d7c..3058aa9180 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,17 @@ Requirements: Windows 10/11 x64, a CPU with AVX2, a Direct3D 12 GPU with shader model 6.6 (and mesh shaders for the world), Rust (pinned in `rust-toolchain.toml`). +Windows 10: its own Direct3D 12 runtime stops at shader model 6.5 on the +GPU (6.2 on WARP), so the title's pipelines are refused and nothing is +drawn. `victory.exe` asks for the Agility SDK runtime instead +(`D3D12SDKVersion` 614, in `D3D12\` next to the executable). Download the +NuGet package `Microsoft.Direct3D.D3D12` 1.614.x and copy its +`build\native\bin\x64\D3D12Core.dll` (and `d3d12SDKLayers.dll`) to +`target\\D3D12\`; for WARP also copy `d3d10warp.dll` from the +package `Microsoft.Direct3D.WARP` next to `victory.exe`. Without that +folder, or on a Windows whose runtime is newer, the system's is used. +Tested on Windows 10 22H2 (19045) with an RX 6800 XT: the world is reached. + To install Rust, use rustup (`winget install --id Rustlang.Rustup -e`, or the installer from https://rustup.rs). The first `cargo` command in this repository then fetches the pinned toolchain. Building needs the MSVC C++ diff --git a/apps/victory/build.rs b/apps/victory/build.rs new file mode 100644 index 0000000000..75a9c1b0a9 --- /dev/null +++ b/apps/victory/build.rs @@ -0,0 +1,13 @@ +//! Exports the Agility SDK's `D3D12SDKVersion` and `D3D12SDKPath` (see +//! `src/main.rs`) from the executable, where the Direct3D 12 loader looks +//! for them. + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + let windows = std::env::var("CARGO_CFG_TARGET_OS").is_ok_and(|os| os == "windows"); + let msvc = std::env::var("CARGO_CFG_TARGET_ENV").is_ok_and(|env| env == "msvc"); + if windows && msvc { + println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKVersion,DATA"); + println!("cargo:rustc-link-arg-bins=/EXPORT:D3D12SDKPath,DATA"); + } +} diff --git a/apps/victory/src/main.rs b/apps/victory/src/main.rs index 5c8749f723..0458d6680f 100644 --- a/apps/victory/src/main.rs +++ b/apps/victory/src/main.rs @@ -15,6 +15,27 @@ use std::path::PathBuf; use anyhow::Result; use clap::{Parser, Subcommand, ValueEnum}; +/// Agility SDK: the Direct3D 12 runtime in `D3D12\` next to the executable +/// (`D3D12Core.dll`, from the user's own download of the +/// Microsoft.Direct3D.D3D12 package of this version) instead of the +/// system's, whose shader model may be too low (Windows 10: SM 6.5 on +/// hardware, 6.2 on WARP; the title's pipelines need 6.6). Without that +/// folder, or on a system whose runtime is newer, the system's is used. +/// Exported by `build.rs`. +// The names the Direct3D 12 loader looks up. +#[cfg(windows)] +#[allow(non_upper_case_globals)] +#[unsafe(no_mangle)] +#[used] +pub static D3D12SDKVersion: u32 = 614; + +/// The folder of [`D3D12SDKVersion`]'s runtime, relative to the executable. +#[cfg(windows)] +#[allow(non_upper_case_globals)] +#[unsafe(no_mangle)] +#[used] +pub static D3D12SDKPath: &[u8; 9] = b".\\D3D12\\\0"; + #[derive(Parser)] #[command( name = "victory",