lint the test targets, make the fps setting real, and stop tonemapping sdr captures

This commit is contained in:
2026-09-21 06:45:23 +03:00
parent 4b850096a1
commit aef64fa4e3
8 changed files with 221 additions and 40 deletions
+21 -12
View File
@@ -24,32 +24,40 @@ fn compile_shaders() {
let fxc = find_fxc();
for (entry, profile) in &[("fullscreen_vs", "vs_5_0"), ("tonemap_ps", "ps_5_0")] {
// (output name, entry point, profile, defines). The pixel shader is built
// twice: an SDR output skips the HDR curve rather than being darkened by it.
let variants: &[(&str, &str, &str, &[&str])] = &[
("fullscreen_vs", "fullscreen_vs", "vs_5_0", &[]),
("tonemap_ps", "tonemap_ps", "ps_5_0", &["TONEMAP=1"]),
("tonemap_ps_sdr", "tonemap_ps", "ps_5_0", &["TONEMAP=0"]),
];
for (name, entry, profile, defines) in variants {
let src = shader_dir.join("tonemap.hlsl");
let dst = out_dir.join(format!("{entry}.cso"));
let dst = out_dir.join(format!("{name}.cso"));
match &fxc {
Some(fxc) => {
let r = Command::new(fxc)
.arg(format!("/T{profile}"))
let mut cmd = Command::new(fxc);
cmd.arg(format!("/T{profile}"))
.arg(format!("/E{entry}"))
.arg("/O3")
.arg("/Fo")
.arg(&dst)
.arg(&src)
.output();
.arg("/O3");
for define in *defines {
cmd.arg(format!("/D{define}"));
}
let r = cmd.arg("/Fo").arg(&dst).arg(&src).output();
match r {
Ok(o) if o.status.success() => {
println!("cargo:rerun-if-changed={}", src.display());
}
Ok(o) => {
println!(
"cargo:warning=fxc failed for {entry}: {}",
"cargo:warning=fxc failed for {name}: {}",
String::from_utf8_lossy(&o.stderr)
);
drop(std::fs::write(&dst, []));
}
Err(e) => {
println!("cargo:warning=could not run fxc for {entry}: {e}");
println!("cargo:warning=could not run fxc for {name}: {e}");
drop(std::fs::write(&dst, []));
}
}
@@ -70,7 +78,8 @@ fn compile_shaders() {
}
/// Locate the newest fxc.exe under the Windows Kits SDK. Returns None if the
/// SDK isn't installed (build still succeeds via the runtime-compile fallback).
/// SDK isn't installed, in which case the build still succeeds but capture
/// refuses to start until it is rebuilt with the SDK present.
fn find_fxc() -> Option<PathBuf> {
let root = PathBuf::from(r"C:\Program Files (x86)\Windows Kits\10\bin");
let Ok(entries) = std::fs::read_dir(&root) else {