Skip to content

Commit db63341

Browse files
committed
fix(AABBTree): do not use async tasks for small tree
1 parent 5355b0f commit db63341

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

include/geode/geometry/detail/aabb_impl.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,15 @@ namespace geode
9595
bboxes, ROOT_INDEX, 0, bboxes.size() );
9696
}
9797
const auto grain = async::detail::auto_grain_size( bboxes.size() );
98-
const auto nb_async_depth = std::log2( grain );
99-
async_depth_ =
100-
depth_ > nb_async_depth ? depth_ - nb_async_depth : depth_;
98+
if( grain < 8 )
99+
{
100+
async_depth_ = 0;
101+
}
102+
else
103+
{
104+
const auto nb_async_depth = std::log2( grain );
105+
async_depth_ = depth_ - nb_async_depth;
106+
}
101107
}
102108

103109
[[nodiscard]] index_t nb_bboxes() const
@@ -458,7 +464,7 @@ namespace geode
458464

459465
// The acceleration is here:
460466
if( !node( node_index1 )
461-
.intersects( other_tree.impl_->node( node_index2 ) ) )
467+
.intersects( other_tree.impl_->node( node_index2 ) ) )
462468
{
463469
return false;
464470
}

0 commit comments

Comments
 (0)