Skip to main content

on_csg_stack

Function on_csg_stack 

Source
pub fn on_csg_stack<R: Send>(f: impl FnOnce() -> R + Send) -> R
Expand description

Run f on a dedicated thread with a stack large enough for deep CSG recursion, blocking until it finishes.

BSP build/clip/invert (and the tree’s Drop) recurse per node, so stack depth scales with polygon count. Callers can sit on small stacks — the iOS main thread gets 1 MiB and secondary Apple threads 512 KiB — where a full-scene CSG conversion overflows (SIGSEGV). Wrap the conversion in this helper whenever the caller’s stack size isn’t under our control.