Files
6gbvram---16gb-ram/crates/victory-gpu/build.rs
T
localandClaude Opus 5.5 dd3307943c Streaming, copy queue, texture pools and a shader cache that survives rebuilds
Textures and staging cut from 64 MB blocks; a kept view per page section and
page lists read again until the title has filled them in; the GPU side told
when streamed bytes land; results fetched over the copy queue
(VICTORY_RELAY_COPY=1); the write-watch journal behind a reader-writer lock;
the shader cache keyed by the translator's sources and `victory shaders`;
helper lanes as in upstream 1733 (VICTORY_HELPER_OWN).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 18:55:40 -06:00

46 lines
1.7 KiB
Rust

//! Fingerprints the shader translator, so that cached translations
//! (`src/shader_cache.rs`) last until the translator itself changes and not
//! only until the next build of anything.
use std::path::{Path, PathBuf};
fn files(dir: &Path, out: &mut Vec<PathBuf>) {
for entry in std::fs::read_dir(dir).into_iter().flatten().flatten() {
let path = entry.path();
if path.is_dir() {
files(&path, out);
} else {
out.push(path);
}
}
}
fn main() {
let here = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap_or_default());
let crates = here.join("..");
let root = crates.join("..");
// The translator, what it is built from, and the form entries are kept in.
let mut all = vec![
crates.join("victory-shader/Cargo.toml"),
here.join("src/shader_cache.rs"),
root.join("Cargo.lock"),
root.join("rust-toolchain.toml"),
];
let source = crates.join("victory-shader/src");
println!("cargo:rerun-if-changed={}", source.display());
files(&source, &mut all);
all.sort();
let mut hash = blake3::Hasher::new();
for path in &all {
println!("cargo:rerun-if-changed={}", path.display());
// Names and line endings as they are in every checkout.
let name = path.file_name().unwrap_or_default().to_string_lossy().into_owned();
let bytes: Vec<u8> = std::fs::read(path).unwrap_or_default().into_iter().filter(|&b| b != 13).collect();
hash.update(name.as_bytes());
hash.update(&(bytes.len() as u64).to_le_bytes());
hash.update(&bytes);
}
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-env=VICTORY_TRANSLATOR={}", hash.finalize().to_hex());
}