Skip to content

Commit

Permalink
add handle joins to test invocations so that even if they use a scene…
Browse files Browse the repository at this point in the history
… that requires an importance map to be baked, that the baking process is not interrupted
  • Loading branch information
gillett-hernandez committed Jul 9, 2024
1 parent e70b479 commit ebc1f61
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ rust_2021_compatibility = "warn"
assigning_clones = "deny"

[features]
fs_isolation = []
build_raymarch = ["sdfu/ultraviolet", "ultraviolet"]
color_grad = ["colorgrad"]
# for scenes with many non-dense meshes, disable sort_mesh_aabb_hits
Expand Down Expand Up @@ -47,7 +46,7 @@ exr = "~1.72"
image = { version = "~0.25", features = ["hdr"] }
# log = "~0.4"
# log-once = "~0.4"
lazy_static = "~1.4"
lazy_static = "~1.5"
math = { git = "https://github.com/gillett-hernandez/rust_cg_math", features = [
"serde",
"deepsize",
Expand Down
2 changes: 1 addition & 1 deletion src/bin/color_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,6 @@ adjust various sliders to change the EV offset.
let _ = eframe::run_native(
"the same color under different illuminants",
options,
Box::new(|_cc| Box::new(controller)),
Box::new(|_cc| Ok(Box::new(controller))),
);
}
3 changes: 3 additions & 0 deletions src/bin/raymarch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ fn main() {
let mut handles = Vec::new();
let world = construct_world(&mut config, PathBuf::from(scene_file_path), &mut handles).unwrap();

for handle in handles {
let _ = handle.join();
}
let camera = world.cameras[0]
.clone()
.with_aspect_ratio(height as f32 / width as f32);
Expand Down
9 changes: 7 additions & 2 deletions src/parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::world::World;

use std::collections::HashMap;
use std::collections::HashSet;
use std::fs;
use std::fs::File;
use std::io::Read;
use std::path::Path;
Expand Down Expand Up @@ -222,7 +221,7 @@ pub fn construct_world<P: AsRef<Path>>(
);
let mut local_material_map = HashMap::new();
assert!(
matches!(fs::try_exists(mesh_data.filename.as_str()), Ok(true)),
matches!(std::fs::try_exists(mesh_data.filename.as_str()), Ok(true)),
"could not find obj file or mtl file {}",
mesh_data.filename.as_str()
);
Expand Down Expand Up @@ -639,6 +638,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}
println!("constructed world");
for mat in &*world.materials {
let name = match mat {
Expand All @@ -662,6 +664,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}
}

#[test]
Expand Down
9 changes: 9 additions & 0 deletions src/world/importance_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}

if let EnvironmentMap::HDR {
importance_map,
Expand Down Expand Up @@ -653,6 +656,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}
let env = &world.environment;

let wavelength_range = BOUNDED_VISIBLE_RANGE;
Expand Down Expand Up @@ -753,6 +759,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}

let wavelength_bounds = BOUNDED_VISIBLE_RANGE;
if let EnvironmentMap::HDR {
Expand Down
3 changes: 3 additions & 0 deletions src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ mod test {
&mut handles,
)
.unwrap();
for handle in handles {
let _ = handle.join();
}

let ray = Ray::new(Point3::new(0.0, 0.0, 7.0), -Vec3::Z);

Expand Down

0 comments on commit ebc1f61

Please sign in to comment.