Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
12 changes: 6 additions & 6 deletions Setup-DexNomRuntime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ try {
[IO.File]::WriteAllText($config, $game.FullName, [Text.UTF8Encoding]::new($false))
} finally { $lock.Dispose() }

$launcher = Join-Path $InstallDir 'victory-play.exe'
Write-Host "Installed DexNom RayTime in $InstallDir"
[IO.Directory]::CreateDirectory($ShortcutDirectory) | Out-Null
$shell = New-Object -ComObject WScript.Shell
foreach ($entry in @(
@{ Name = 'DexNom RayTime'; Arguments = '' }
@{ Name = 'DexNom RayTime (Experimental RT)'; Arguments = '--rt' }
@{ Name = 'DexNom RayTime (FSR Quality 4K)'; Arguments = '--rt --console series-x --local-gpu-memory --fsr-quality --sparse-textures --no-upload-ahead --capture-readbacks --rt-write-stats' }
@{ Name = 'DexNom RayTime'; Program = 'victory-play.exe'; Arguments = '' }
@{ Name = 'DexNom RayTime (Experimental RT)'; Program = 'victory-play.exe'; Arguments = '--rt' }
@{ Name = 'DexNom RayTime (FSR Quality 4K)'; Program = 'victory-play.exe'; Arguments = '--rt --console series-x --local-gpu-memory --fsr-quality --sparse-textures --no-upload-ahead --capture-readbacks --rt-write-stats' }
@{ Name = 'DexNom RayTime (Preload and Play)'; Program = 'victory-warm.exe'; Arguments = '--play' }
)) {
$shortcut = $shell.CreateShortcut((Join-Path $ShortcutDirectory ($entry.Name + '.lnk')))
$shortcut.TargetPath = $launcher
$shortcut.TargetPath = Join-Path $InstallDir $entry.Program
$shortcut.Arguments = $entry.Arguments
$shortcut.WorkingDirectory = $InstallDir
$shortcut.Save()
}
Write-Host "Open DexNom RayTime from $ShortcutDirectory. The FSR Quality 4K shortcut uses the tested ray-tracing profile."
Write-Host "Open DexNom RayTime from $ShortcutDirectory. The FSR Quality 4K shortcut uses the tested ray-tracing profile. The Preload and Play shortcut finishes shader preloading before launch."
2 changes: 1 addition & 1 deletion apps/victory/src/bin/victory-warm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mod windows_launcher;
#[cfg(windows)]
fn main() {
if let Err(error) = windows_launcher::run(true) {
eprintln!("Shader preload failed\n{error:#}");
eprintln!("DexNom Runtime failed\n{error:#}");
std::process::exit(1);
}
}
210 changes: 113 additions & 97 deletions apps/victory/src/play_launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct LaunchOptions {
rt_write_stats: bool,
rt_store_trace: bool,
lighting_trace: bool,
play: bool,
}

fn launcher_options(
Expand All @@ -47,6 +48,7 @@ fn launcher_options(
rt_write_stats: false,
rt_store_trace: false,
lighting_trace: false,
play: false,
};
while let Some(option) = args.peek() {
if option == "--warp" {
Expand Down Expand Up @@ -87,6 +89,8 @@ fn launcher_options(
options.rt_store_trace = true;
} else if option == "--lighting-trace" {
options.lighting_trace = true;
} else if option == "--play" {
options.play = true;
} else if option == "--console" {
args.next();
options.console = match args.next().as_deref().and_then(std::ffi::OsStr::to_str) {
Expand Down Expand Up @@ -119,8 +123,12 @@ pub(super) fn run(warm: bool) -> anyhow::Result<()> {
let mut args = std::env::args_os().skip(1).peekable();
let LaunchOptions {
warp, ray_tracing, static_bvh, console, local_gpu_memory, native_1440p, render_1080p, fsr,
sparse_textures, upload_ahead, capture_readbacks, rt_write_stats, rt_store_trace, lighting_trace,
sparse_textures, upload_ahead, capture_readbacks, rt_write_stats, rt_store_trace, lighting_trace, play,
} = launcher_options(&mut args)?;
if play && !warm {
bail!("--play is only accepted by victory-warm");
}
let play = play || !warm;
let game = match args.next() {
Some(path) => PathBuf::from(path),
None => {
Expand All @@ -132,8 +140,9 @@ pub(super) fn run(warm: bool) -> anyhow::Result<()> {
};
if args.next().is_some() {
bail!(
"Usage\n{} [--rt | --no-rt | --rt-static-bvh] [--warp] [--console series-x|series-s] [--local-gpu-memory] [--native-1440p | --1080p-to-1440p | --fsr-quality | --fsr-balanced | --fsr-performance] [--sparse-textures] [--upload-ahead | --no-upload-ahead] [--capture-readbacks] [--rt-write-stats] [--rt-store-trace] [--lighting-trace] [game executable]",
launcher.display()
"Usage\n{}{} [--rt | --no-rt | --rt-static-bvh] [--warp] [--console series-x|series-s] [--local-gpu-memory] [--native-1440p | --1080p-to-1440p | --fsr-quality | --fsr-balanced | --fsr-performance] [--sparse-textures] [--upload-ahead | --no-upload-ahead] [--capture-readbacks] [--rt-write-stats] [--rt-store-trace] [--lighting-trace] [game executable]",
launcher.display(),
if warm { " [--play]" } else { "" }
);
}
if !game.is_file() || !runtime.is_file() {
Expand Down Expand Up @@ -172,97 +181,105 @@ pub(super) fn run(warm: bool) -> anyhow::Result<()> {
runtime.display(),
game.display()
)?;
let latest = if warm {
"latest-warm.txt"
} else {
"latest.txt"
};
fs::write(logs.join(latest), path.display().to_string())?;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
let mut child = Command::new(&runtime);
if let Some(on) = ray_tracing {
child.env("VICTORY_RAY_TRACING", if on { "1" } else { "0" });
writeln!(log, "Ray tracing requested: {}", if on { "on" } else { "off" })?;
} else if static_bvh {
child.env("VICTORY_RAY_TRACING", "static-bvh");
writeln!(log, "Ray tracing requested: static BVH traversal")?;
}
if warp {
child.env("VICTORY_D3D12_WARP", "1");
}
if local_gpu_memory {
child.env("VICTORY_LOCAL_GPU_INPUTS", "1");
}
if native_1440p {
child
.env("VICTORY_NATIVE_1440P", "1")
.env("VICTORY_RENDER_1080P", if render_1080p { "1" } else { "0" })
.env("VICTORY_FSR_4K", "0");
let expected_render = if render_1080p { "1920x1080" } else { "2560x1440" };
writeln!(log, "Expected scene rendering {expected_render}, output 2560x1440")?;
}
if let Some(preset) = fsr {
child.env("VICTORY_FSR_4K", preset.name());
let provider = folder.join("fidelityfx");
if std::env::var_os("VICTORY_FIDELITYFX_DIR").is_none()
&& provider.join("amd_fidelityfx_upscaler_dx12.dll").is_file()
{
child.env("VICTORY_FIDELITYFX_DIR", provider);
let new_child = |log: &mut File| -> anyhow::Result<Command> {
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
let mut child = Command::new(&runtime);
if let Some(on) = ray_tracing {
child.env("VICTORY_RAY_TRACING", if on { "1" } else { "0" });
writeln!(log, "Ray tracing requested: {}", if on { "on" } else { "off" })?;
} else if static_bvh {
child.env("VICTORY_RAY_TRACING", "static-bvh");
writeln!(log, "Ray tracing requested: static BVH traversal")?;
}
let [width, height] = preset.render_size();
writeln!(log, "FSR {} (SDK mode {}) requested at {width}x{height} scene, 3840x2160 output", preset.name(), preset.mode())?;
}
if (fsr.is_some() || upload_ahead == Some(true)) && std::env::var_os("VICTORY_LOG").is_none() {
let filter = std::env::var("RUST_LOG").unwrap_or_else(|_| "warn".into());
child.env("VICTORY_LOG", format!(
"{filter},victory::run::native_1440p=info,victory_hle::modules::fidelityfx=info,victory_gpu::host=info,victory_gpu::texture::ahead=info"
));
}
if let Some(enabled) = upload_ahead {
let value = if enabled { "1" } else { "0" };
child.env("VICTORY_UPLOAD_AHEAD", value);
writeln!(log, "Texture copy queue requested: {}", if enabled { "on" } else { "off" })?;
}
for (enabled, key, message) in [
(sparse_textures, "VICTORY_LEVELS_ON_DEMAND", "Sparse texture mips requested"),
(capture_readbacks, "VICTORY_CAPTURE_READBACKS", "Dirty-page readback capture requested"),
(rt_write_stats, "VICTORY_RT_WRITE_STATS", "Ray-tracing write statistics requested"),
] {
if enabled {
child.env(key, "1");
writeln!(log, "{message}")?;
if warp {
child.env("VICTORY_D3D12_WARP", "1");
}
if local_gpu_memory {
child.env("VICTORY_LOCAL_GPU_INPUTS", "1");
}
if native_1440p {
child
.env("VICTORY_NATIVE_1440P", "1")
.env("VICTORY_RENDER_1080P", if render_1080p { "1" } else { "0" })
.env("VICTORY_FSR_4K", "0");
let expected_render = if render_1080p { "1920x1080" } else { "2560x1440" };
writeln!(log, "Expected scene rendering {expected_render}, output 2560x1440")?;
}
if let Some(preset) = fsr {
child.env("VICTORY_FSR_4K", preset.name());
let provider = folder.join("fidelityfx");
if std::env::var_os("VICTORY_FIDELITYFX_DIR").is_none()
&& provider.join("amd_fidelityfx_upscaler_dx12.dll").is_file()
{
child.env("VICTORY_FIDELITYFX_DIR", provider);
}
let [width, height] = preset.render_size();
writeln!(log, "FSR {} (SDK mode {}) requested at {width}x{height} scene, 3840x2160 output", preset.name(), preset.mode())?;
}
if (fsr.is_some() || upload_ahead == Some(true)) && std::env::var_os("VICTORY_LOG").is_none() {
let filter = std::env::var("RUST_LOG").unwrap_or_else(|_| "warn".into());
child.env("VICTORY_LOG", format!(
"{filter},victory::run::native_1440p=info,victory_hle::modules::fidelityfx=info,victory_gpu::host=info,victory_gpu::texture::ahead=info"
));
}
if let Some(enabled) = upload_ahead {
let value = if enabled { "1" } else { "0" };
child.env("VICTORY_UPLOAD_AHEAD", value);
writeln!(log, "Texture copy queue requested: {}", if enabled { "on" } else { "off" })?;
}
for (enabled, key, message) in [
(sparse_textures, "VICTORY_LEVELS_ON_DEMAND", "Sparse texture mips requested"),
(capture_readbacks, "VICTORY_CAPTURE_READBACKS", "Dirty-page readback capture requested"),
(rt_write_stats, "VICTORY_RT_WRITE_STATS", "Ray-tracing write statistics requested"),
] {
if enabled {
child.env(key, "1");
writeln!(log, "{message}")?;
}
}
if rt_store_trace {
child.env("VICTORY_CAPTURE_RAW_STORES", victory_shader::emit::RAW_STORE_PROBE_HASH);
writeln!(log, "InitHeaders store trace requested")?;
}
if lighting_trace {
let trace = folder.join("lighting-trace").join(format!("{started}-{}", std::process::id()));
fs::create_dir_all(&trace)?;
let request = trace.join("request.txt");
// Lighting using the shadow mask, RT resolve, auto-exposure, and the final composite.
child
.env("VICTORY_CAPTURE", &trace)
.env("VICTORY_CAPTURE_REQUEST", &request)
.env("VICTORY_DUMP_AFTER", "2bf91065944bcff4,7f05ddab771799a9,e622b718b6d9b057,6318f669e4f17d65")
.env("VICTORY_DUMP_INPUT", "e622b718b6d9b057:s1+0");
writeln!(log, "Lighting trace request file {}", request.display())?;
}
if std::env::var_os("VICTORY_DEBUG_HUD").is_none() {
child.env("VICTORY_DEBUG_HUD", "1");
}
}
if rt_store_trace {
child.env("VICTORY_CAPTURE_RAW_STORES", victory_shader::emit::RAW_STORE_PROBE_HASH);
writeln!(log, "InitHeaders store trace requested")?;
}
if lighting_trace {
let trace = folder.join("lighting-trace").join(format!("{started}-{}", std::process::id()));
fs::create_dir_all(&trace)?;
let request = trace.join("request.txt");
// Lighting using the shadow mask, RT resolve, auto-exposure, and the final composite.
child
.env("VICTORY_CAPTURE", &trace)
.env("VICTORY_CAPTURE_REQUEST", &request)
.env("VICTORY_DUMP_AFTER", "2bf91065944bcff4,7f05ddab771799a9,e622b718b6d9b057,6318f669e4f17d65")
.env("VICTORY_DUMP_INPUT", "e622b718b6d9b057:s1+0");
writeln!(log, "Lighting trace request file {}", request.display())?;
}
if std::env::var_os("VICTORY_DEBUG_HUD").is_none() {
child.env("VICTORY_DEBUG_HUD", "1");
.current_dir(folder)
.env("VICTORY_DATA_DIR", &state)
.env("VICTORY_CACHE_DIR", &cache)
.stdin(Stdio::null())
.stderr(log.try_clone()?)
.creation_flags(CREATE_NO_WINDOW);
Ok(child)
};
if warm {
fs::write(logs.join("latest-warm.txt"), path.display().to_string())?;
let mut child = new_child(&mut log)?;
let status = preload(&mut child, &game, &cache, &path, &mut log)?;
if !status.success() {
bail!("Shader preload exited with {status}.\n\nLog file\n{}", path.display());
}
}
child
.current_dir(folder)
.env("VICTORY_DATA_DIR", &state)
.env("VICTORY_CACHE_DIR", &cache)
.stdin(Stdio::null())
.stderr(log.try_clone()?)
.creation_flags(CREATE_NO_WINDOW);
let status = if warm {
preload(&mut child, &game, &cache, &path, &mut log)?
} else {
let status = child
if play {
if warm {
writeln!(log, "Shader preload finished. Starting the game.")?;
println!("Shader preload finished. Starting the game.");
}
fs::write(logs.join("latest.txt"), path.display().to_string())?;
let status = new_child(&mut log)?
.arg("run")
.arg(&game)
.args([
Expand All @@ -276,13 +293,9 @@ pub(super) fn run(warm: bool) -> anyhow::Result<()> {
.status()
.with_context(|| format!("Could not start {}", runtime.display()))?;
writeln!(log, "VIctory exited with {status}")?;
status
};
if !status.success() {
bail!(
"VIctory exited with {status}.\n\nLog file\n{}",
path.display()
);
if !status.success() {
bail!("VIctory exited with {status}.\n\nLog file\n{}", path.display());
}
}
Ok(())
}
Expand Down Expand Up @@ -476,6 +489,9 @@ mod tests {
#[test]
fn empty_and_incomplete_scans_are_reported() {
assert!(check_warm_summary(None).is_err());
assert!(check_warm_summary(Some(
"progress 15 s 2000 shaders checked 1990 translated 100 compute pipelines"
)).is_err());
assert!(
check_warm_summary(Some(
"warm 0 translated, 0 refused; 0 compute pipelines, 0 refused; 0 s"
Expand Down
29 changes: 25 additions & 4 deletions apps/victory/src/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,13 @@ pub fn run(
);
}
if pipelines {
Host::new(false).map_err(anyhow::Error::msg)?;
let host = Host::new(false).map_err(anyhow::Error::msg)?;
if emit::host_max_wave() == 0
&& let Some(max) = host.max_wave_lanes()
{
emit::set_host_max_wave(max);
println!("host waves at most {max} lanes");
}
}
let pairs: Vec<(String, String)> = std::env::var("VICTORY_PAIRS")
.unwrap_or_default()
Expand Down Expand Up @@ -309,12 +315,17 @@ pub fn run(
/// `victory warm`: fills the caches a run reads (`Command::Warm`).
pub fn warm(paths: Vec<PathBuf>, jobs: Option<usize>, pipelines: bool, rays: crate::RayOptions) -> Result<()> {
let paths = crate::default_paths(paths)?;
if pipelines {
victory_hle::modules::d3d12x::check_preload_device()?;
}
let cfg = victory_core::Config::load()?;
rays.apply(&cfg);
victory_hle::modules::d3d12x::use_shader_cache(cfg.cache_subdir("shaders")?);
let threads = jobs.unwrap_or_else(|| std::thread::available_parallelism().map_or(4, |n| n.get()));
let seen = Mutex::new(HashSet::new());
let [done, refused, made, unmade, omitted] = [const { AtomicUsize::new(0) }; 5];
let completed = AtomicUsize::new(0);
let last_interval = AtomicUsize::new(0);
let started = std::time::Instant::now();
for root in &paths {
for entry in walkdir::WalkDir::new(root).into_iter().filter_map(Result::ok) {
Expand Down Expand Up @@ -355,14 +366,24 @@ pub fn warm(paths: Vec<PathBuf>, jobs: Option<usize>, pipelines: bool, rays: cra
continue;
};
let count = if translated { &done } else { &refused };
let n = count.fetch_add(1, Ordering::Relaxed) + 1;
count.fetch_add(1, Ordering::Relaxed);
match pipeline {
Some(true) => made.fetch_add(1, Ordering::Relaxed),
Some(false) => unmade.fetch_add(1, Ordering::Relaxed),
None => 0,
};
if n.is_multiple_of(2000) {
println!("{:6.0} s {n} shaders", started.elapsed().as_secs_f64());
let n = completed.fetch_add(1, Ordering::Relaxed) + 1;
let elapsed = started.elapsed().as_secs();
let interval = (elapsed / 15) as usize;
let periodic =
last_interval.fetch_max(interval, Ordering::Relaxed) < interval;
if n.is_multiple_of(2000) || periodic {
let translated = done.load(Ordering::Relaxed);
let checked = translated + refused.load(Ordering::Relaxed);
let pipelines = made.load(Ordering::Relaxed);
println!(
"progress {elapsed} s {checked} shaders checked {translated} translated {pipelines} compute pipelines"
);
}
}
});
Expand Down
Loading
Loading