diff --git a/.gitignore b/.gitignore index f95caf5..d08651e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /target -/kernels/compute/target \ No newline at end of file +/kernels/target \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 4263a0e..a2c310d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -432,14 +432,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "compute" -version = "0.1.0" -dependencies = [ - "shared_structs", - "spirv-std", -] - [[package]] name = "core-foundation" version = "0.9.3" @@ -1353,6 +1345,14 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernels" +version = "0.1.0" +dependencies = [ + "shared_structs", + "spirv-std", +] + [[package]] name = "khronos-egl" version = "4.1.0" @@ -1866,9 +1866,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "png" @@ -2147,13 +2147,13 @@ name = "rustic" version = "0.1.0" dependencies = [ "bytemuck", - "compute", "egui", "egui_glium", "glam", "glium", "gpgpu", "image", + "kernels", "lazy_static", "oidn", "parking_lot", diff --git a/Cargo.toml b/Cargo.toml index 7537c00..e9a1c78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] shared_structs = { path = "shared_structs" } -compute = { path = "kernels/compute" } +kernels = { path = "kernels" } bytemuck = { version = "1.13.1", features = ["derive"] } glam = { version = "0.22.0", features = ["bytemuck"] } gpgpu = { git = "https://github.com/pema99/gpgpu-rs.git", branch = "samplers", features = ["image", "integrate-image"] } diff --git a/build.rs b/build.rs index 15c64e1..e061be0 100644 --- a/build.rs +++ b/build.rs @@ -17,24 +17,21 @@ fn get_output_path() -> PathBuf { } fn main() { - for kernel in std::fs::read_dir("kernels").expect("Error finding kernels folder") { - let path = kernel.expect("Invalid path in kernels folder").path(); - SpirvBuilder::new(path, "spirv-unknown-vulkan1.1") - .extra_arg("--no-spirt") - .build() - .expect("Kernel failed to compile"); + SpirvBuilder::new("kernels", "spirv-unknown-vulkan1.1") + .extra_arg("--no-spirt") + .build() + .expect("Kernel failed to compile"); - #[cfg(feature = "oidn")] - { - let oidn_dir = std::env::var("OIDN_DIR").expect("OIDN_DIR environment variable not set. Please set this to the OIDN install directory root."); - let oidn_path = Path::new(&oidn_dir).join("bin"); - for entry in std::fs::read_dir(oidn_path).expect("Error finding OIDN binaries") { - let path = entry.expect("Invalid path in OIDN binaries folder").path(); - let file_name = path.file_name().unwrap().to_str().unwrap(); - let mut output_path = get_output_path(); - output_path.push(file_name); - std::fs::copy(path, output_path).expect("Failed to copy OIDN binary"); - } + #[cfg(feature = "oidn")] + { + let oidn_dir = std::env::var("OIDN_DIR").expect("OIDN_DIR environment variable not set. Please set this to the OIDN install directory root."); + let oidn_path = Path::new(&oidn_dir).join("bin"); + for entry in std::fs::read_dir(oidn_path).expect("Error finding OIDN binaries") { + let path = entry.expect("Invalid path in OIDN binaries folder").path(); + let file_name = path.file_name().unwrap().to_str().unwrap(); + let mut output_path = get_output_path(); + output_path.push(file_name); + std::fs::copy(path, output_path).expect("Failed to copy OIDN binary"); } } } diff --git a/kernels/compute/Cargo.lock b/kernels/Cargo.lock similarity index 84% rename from kernels/compute/Cargo.lock rename to kernels/Cargo.lock index 05c5716..1c61cb0 100644 --- a/kernels/compute/Cargo.lock +++ b/kernels/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" @@ -34,14 +34,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "compute" -version = "0.1.0" -dependencies = [ - "shared_structs", - "spirv-std", -] - [[package]] name = "glam" version = "0.22.0" @@ -52,17 +44,25 @@ dependencies = [ "num-traits", ] +[[package]] +name = "kernels" +version = "0.1.0" +dependencies = [ + "shared_structs", + "spirv-std", +] + [[package]] name = "libm" -version = "0.2.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", "libm", @@ -116,7 +116,7 @@ dependencies = [ "proc-macro2", "quote", "spirv-std-types", - "syn 1.0.75", + "syn 1.0.109", ] [[package]] @@ -127,13 +127,13 @@ checksum = "5a8f7324f64b41beeaae97030f6128ad72747466b4c03459c3714adb84bc6f63" [[package]] name = "syn" -version = "1.0.75" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -152,9 +152,3 @@ name = "unicode-ident" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" diff --git a/kernels/compute/Cargo.toml b/kernels/Cargo.toml similarity index 63% rename from kernels/compute/Cargo.toml rename to kernels/Cargo.toml index 2f986d5..3887e81 100644 --- a/kernels/compute/Cargo.toml +++ b/kernels/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "compute" +name = "kernels" version = "0.1.0" edition = "2021" @@ -7,5 +7,5 @@ edition = "2021" crate-type = ["dylib", "lib"] [dependencies] -shared_structs = { path = "../../shared_structs" } +shared_structs = { path = "../shared_structs" } spirv-std = "0.6.0" \ No newline at end of file diff --git a/kernels/compute/src/bsdf.rs b/kernels/src/bsdf.rs similarity index 100% rename from kernels/compute/src/bsdf.rs rename to kernels/src/bsdf.rs diff --git a/kernels/compute/src/intersection.rs b/kernels/src/intersection.rs similarity index 100% rename from kernels/compute/src/intersection.rs rename to kernels/src/intersection.rs diff --git a/kernels/compute/src/lib.rs b/kernels/src/lib.rs similarity index 100% rename from kernels/compute/src/lib.rs rename to kernels/src/lib.rs diff --git a/kernels/compute/src/rng.rs b/kernels/src/rng.rs similarity index 100% rename from kernels/compute/src/rng.rs rename to kernels/src/rng.rs diff --git a/kernels/compute/src/skybox.rs b/kernels/src/skybox.rs similarity index 100% rename from kernels/compute/src/skybox.rs rename to kernels/src/skybox.rs diff --git a/kernels/compute/src/util.rs b/kernels/src/util.rs similarity index 100% rename from kernels/compute/src/util.rs rename to kernels/src/util.rs diff --git a/kernels/compute/src/vec.rs b/kernels/src/vec.rs similarity index 100% rename from kernels/compute/src/vec.rs rename to kernels/src/vec.rs diff --git a/src/trace.rs b/src/trace.rs index b55f934..3f40f49 100644 --- a/src/trace.rs +++ b/src/trace.rs @@ -1,4 +1,4 @@ -const KERNEL: &[u8] = include_bytes!(env!("compute.spv")); +const KERNEL: &[u8] = include_bytes!(env!("kernels.spv")); lazy_static::lazy_static! { pub static ref FW: gpgpu::Framework = gpgpu::Framework::default();