Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apps/victory/build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
}
18 changes: 18 additions & 0 deletions apps/victory/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions crates/victory-gpu/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,18 @@ fn footprint(desc: &ResourceDesc) -> Option<AllocationInfo> {

/// 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,
Expand Down