public unsafe void BuildTreeTasks([Values(2, 10, 33, 100, 1000)] int elementCount)
        {
            const int threadCount = 8;
            int       numNodes    = elementCount + Constants.MaxNumTreeBranches;

            var points  = new NativeArray <PointAndIndex>(elementCount, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
            var aabbs   = new NativeArray <Aabb>(elementCount, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
            var filters = new NativeArray <CollisionFilter>(elementCount, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

            InitInputArrays(points, aabbs, filters);

            var nodes = new NativeArray <Node>(numNodes, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

            var ranges           = new NativeArray <Range>(Constants.MaxNumTreeBranches, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
            var branchNodeOffset = new NativeArray <int>(Constants.MaxNumTreeBranches, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
            var branchCount      = new NativeArray <int>(1, Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

            var handle = new BuildFirstNLevelsJob
            {
                Points            = points,
                Nodes             = (Node *)nodes.GetUnsafePtr(),
                Ranges            = ranges,
                BranchNodeOffsets = branchNodeOffset,
                BranchCount       = branchCount,
                ThreadCount       = threadCount
            }.Schedule();

            var task2 = new BuildBranchesJob
            {
                Points            = points,
                Aabbs             = aabbs,
                BodyFilters       = filters,
                Nodes             = (Node *)nodes.GetUnsafePtr(),
                NodeFilters       = null,
                Ranges            = ranges,
                BranchNodeOffsets = branchNodeOffset,
                BranchCount       = branchCount
            };

            var task3 = new FinalizeTreeJob
            {
                Aabbs             = aabbs,
                Nodes             = (Node *)nodes.GetUnsafePtr(),
                BranchNodeOffsets = branchNodeOffset,
                NumNodes          = nodes.Length,
                LeafFilters       = filters,
                BranchCount       = branchCount
            };

            handle = task2.Schedule(Constants.MaxNumTreeBranches, 1, handle);
            handle = task3.Schedule(handle);
            handle.Complete();

            var bvh = new BoundingVolumeHierarchy(nodes);

            bvh.CheckIntegrity();

            filters.Dispose();
            nodes.Dispose();
            ranges.Dispose();
            branchCount.Dispose();
        }