moves compiled shaders, first version with scene info on gpu

This commit is contained in:
zomseffen 2025-01-07 23:21:09 +01:00
parent 57e862832a
commit 694d93c0f3
20 changed files with 623 additions and 113 deletions

View file

@ -6,32 +6,40 @@ fn main() {
println!("cargo::rerun-if-changed=shaders/cube.frag");
println!("cargo::rerun-if-changed=shaders/cube.geom");
println!("cargo::rerun-if-changed=shaders/cube.vert");
println!("cargo::rerun-if-changed=shaders/geo_cube.spv");
println!("cargo::rerun-if-changed=shaders/frag_cube.spv");
println!("cargo::rerun-if-changed=shaders/vert_cube.spv");
println!("cargo::rerun-if-changed=shaders/compiled/geo_cube.spv");
println!("cargo::rerun-if-changed=shaders/compiled/frag_cube.spv");
println!("cargo::rerun-if-changed=shaders/compiled/vert_cube.spv");
println!("cargo::rerun-if-changed=shaders/cuboid.frag");
println!("cargo::rerun-if-changed=shaders/cuboid.geom");
println!("cargo::rerun-if-changed=shaders/cuboid.vert");
println!("cargo::rerun-if-changed=shaders/geo_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/frag_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/vert_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/compiled/geo_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/compiled/frag_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/compiled/vert_cuboid.spv");
println!("cargo::rerun-if-changed=shaders/rt_quad.vert");
println!("cargo::rerun-if-changed=shaders/compiled/vert_rt_quad.spv");
println!("cargo::rerun-if-changed=shaders/rt_quad.frag");
println!("cargo::rerun-if-changed=shaders/compiled/frag_rt_quad.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/geo_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/frag_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/vert_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/geo_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/frag_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/compiled/vert_cuboid.spv");
#[warn(unused_must_use)]
std::fs::remove_file("shaders/compiled/vert_rt_quad.spv");
#[warn(unused_must_use)]
std::fs::remove_file("shaders/compiled/frag_rt_quad.spv");
if std::env::consts::OS == "windows" {
#[allow(unused_must_use)]
std::fs::remove_file("shaders/geo_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/frag_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/vert_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/geo_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/frag_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/vert_cuboid.spv");
#[warn(unused_must_use)]
// probably need to check the os and have different versions
let mut command = Command::new("./shaders/compile.bat");
let output = command.output().expect("Failed to execute command");
println!("status: {}", output.status);
@ -40,20 +48,6 @@ fn main() {
assert!(output.status.success());
} else if std::env::consts::OS == "linux" {
#[allow(unused_must_use)]
std::fs::remove_file("shaders/geo_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/frag_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/vert_cube.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/geo_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/frag_cuboid.spv");
#[allow(unused_must_use)]
std::fs::remove_file("shaders/vert_cuboid.spv");
#[warn(unused_must_use)]
// probably need to check the os and have different versions
let mut command = Command::new("./shaders/compile.sh");
let output = command.output().expect("Failed to execute command");
println!("status: {}", output.status);
@ -63,10 +57,12 @@ fn main() {
assert!(output.status.success());
}
assert!(Path::new("shaders/geo_cube.spv").exists());
assert!(Path::new("shaders/frag_cube.spv").exists());
assert!(Path::new("shaders/vert_cube.spv").exists());
assert!(Path::new("shaders/geo_cuboid.spv").exists());
assert!(Path::new("shaders/frag_cuboid.spv").exists());
assert!(Path::new("shaders/vert_cuboid.spv").exists());
assert!(Path::new("shaders/compiled/geo_cube.spv").exists());
assert!(Path::new("shaders/compiled/frag_cube.spv").exists());
assert!(Path::new("shaders/compiled/vert_cube.spv").exists());
assert!(Path::new("shaders/compiled/geo_cuboid.spv").exists());
assert!(Path::new("shaders/compiled/frag_cuboid.spv").exists());
assert!(Path::new("shaders/compiled/vert_cuboid.spv").exists());
assert!(Path::new("shaders/compiled/vert_rt_quad.spv").exists());
assert!(Path::new("shaders/compiled/frag_rt_quad.spv").exists());
}