diff --git a/apps/victory/build.rs b/apps/victory/build.rs new file mode 100644 index 0000000000..438fde4e20 --- /dev/null +++ b/apps/victory/build.rs @@ -0,0 +1,11 @@ +// Exports the two symbols the DirectX 12 Agility SDK looks for, so the D3D12 +// runtime loads `D3D12Core.dll` from the `D3D12` folder beside the executable +// instead of the system copy. Rust's bin crates carry no export table, so the +// linker is told explicitly; `#[unsafe(no_mangle)]` in `main.rs` keeps the +// names unmangled. +fn main() { + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") { + println!("cargo:rustc-link-arg=/EXPORT:D3D12SDKVersion,DATA"); + println!("cargo:rustc-link-arg=/EXPORT:D3D12SDKPath,DATA"); + } +} diff --git a/apps/victory/src/main.rs b/apps/victory/src/main.rs index 4cf7c314f3..41336d3a1b 100644 --- a/apps/victory/src/main.rs +++ b/apps/victory/src/main.rs @@ -3,6 +3,24 @@ //! Every command reads the user's own files and writes only to stdout or to //! the user's cache directory (outside the repository). +// The DirectX 12 Agility SDK looks for these two symbols in the executable. +// Exporting them makes the D3D12 runtime load `D3D12Core.dll` from the `D3D12` +// folder beside the binary instead of the in-box copy, which is what lets the +// title's root signatures work on Windows 10 at all: they carry +// `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED | +// ALLOW_INPUT_ASSEMBLER` (0xC01), and the 19041 runtime refuses the whole +// root signature over the two `*_HEAP_DIRECTLY_INDEXED` bits, so every +// pipeline fails to create and the title faults seconds in. +// +/// The version the runtime reads at load time; 614 selects Agility SDK 1.614. +#[unsafe(no_mangle)] +pub static D3D12SDKVersion: u32 = 614; + +/// The folder the runtime loads `D3D12Core.dll` from, relative to the +/// executable. Written once by the runtime at load time; never read here. +#[unsafe(no_mangle)] +pub static mut D3D12SDKPath: *const i8 = c".\\D3D12\\".as_ptr(); + mod census; mod inspect; mod run; diff --git a/crates/victory-gpu/src/resource.rs b/crates/victory-gpu/src/resource.rs index 46c5c71abf..c46c2e829e 100644 --- a/crates/victory-gpu/src/resource.rs +++ b/crates/victory-gpu/src/resource.rs @@ -228,8 +228,18 @@ fn footprint(desc: &ResourceDesc) -> Option { /// A format as the host has it. The console's 16-bit depth with stencil /// (and its typeless views) has no PC format: the 24-bit ones stand in. +/// +/// The console's packed 16-bit colour targets have no host format either: +/// `B5G5R5A1_UNORM` (86) takes no unordered access and `B4G4R4A4_UNORM` +/// (115) takes no render target, so both fail to create when the title asks +/// for a render target or UAV view. Their 8-bit RGBA stand-in is a superset +/// of both in range, so a target that only carries colour through the +/// pipeline loses nothing but the packing. Without this the title's UI +/// composition targets fail to create and the whole UI layer goes missing. pub(crate) fn pc_format(format: u32) -> u32 { match format { + 86 => 28, + 115 => 28, 118 => 45, 119 => 46, 120 => 47,