Skip to content

Commit

Permalink
Move kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
pema99 committed May 3, 2023
1 parent c63bd71 commit c0491f7
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
/kernels/compute/target
/kernels/target
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
31 changes: 14 additions & 17 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
42 changes: 18 additions & 24 deletions kernels/compute/Cargo.lock → kernels/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions kernels/compute/Cargo.toml → kernels/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "compute"
name = "kernels"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["dylib", "lib"]

[dependencies]
shared_structs = { path = "../../shared_structs" }
shared_structs = { path = "../shared_structs" }
spirv-std = "0.6.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/trace.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down

0 comments on commit c0491f7

Please sign in to comment.