824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 1 | use std::path::PathBuf; |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 2 | use std::process::Command; |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 3 | |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 4 | fn main() { |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 5 | let out = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR")); |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 6 | println!("cargo:rerun-if-changed=shaders"); |
96db497859dc | atagen | 2026-10-16 11:27 UTC | 7 | for name in ["quad.vert", "solid.frag", "texture.frag", "effect.frag"] { |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 8 | let status = Command::new("glslangValidator") |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 9 | .args(["-V", "--target-env", "vulkan1.3", "-o"]) |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 10 | .arg(out.join(format!("{name}.spv"))) |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 11 | .arg(format!("shaders/{name}")) |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 12 | .status() |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 13 | .expect("glslangValidator not found, build inside the nix devshell"); |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 14 | assert!(status.success(), "failed to compile shaders/{name}"); |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 15 | } |
824bf02b6e55 | atagen | 2026-10-16 09:15 UTC | 16 | } |