Removed a timer from a hot loop, and fixed node-test stat.

Gives I small performance boost, and now ray/node tests are
actually reported correctly.  Yay!
This commit is contained in:
Nathan Vegdahl 2019-06-29 09:46:39 +09:00
parent 5a53d7f6f6
commit 68fba19fc6
2 changed files with 1 additions and 16 deletions

View File

@ -104,8 +104,6 @@ impl<'a> BVH4<'a> {
return;
}
let mut timer = Timer::new();
let mut trav_time: f64 = 0.0;
let mut node_tests: u64 = 0;
let traversal_table =
@ -116,13 +114,13 @@ impl<'a> BVH4<'a> {
let mut stack_ptr = 1;
while stack_ptr > 0 {
node_tests += ray_stack.ray_count_in_next_task() as u64;
match node_stack[stack_ptr] {
&BVH4Node::Internal {
bounds,
children,
traversal_code,
} => {
node_tests += ray_stack.ray_count_in_next_task() as u64;
let mut all_hits = Bool4::new_false();
// Ray testing
@ -163,23 +161,14 @@ impl<'a> BVH4<'a> {
}
&BVH4Node::Leaf { object_range } => {
trav_time += timer.tick() as f64;
// Do the ray tests.
obj_ray_test(object_range.0..object_range.1, rays, ray_stack);
timer.tick();
stack_ptr -= 1;
}
}
}
trav_time += timer.tick() as f64;
ACCEL_TRAV_TIME.with(|att| {
let v = att.get();
att.set(v + trav_time);
});
ACCEL_NODE_RAY_TESTS.with(|anv| {
let v = anv.get();
anv.set(v + node_tests);

View File

@ -297,10 +297,6 @@ fn main() {
"\t\t\tRays/sec: {}",
(rstats.ray_count as f64 / (ntime * rstats.trace_time) as f64) as u64
);
println!(
"\t\t\tTraversal: {:.3}s",
ntime * rstats.accel_traversal_time
);
println!("\t\t\tRay/node tests: {}", rstats.accel_node_visits);
println!(
"\t\tInitial ray generation: {:.3}s",