1 | // Copyright 2009-2021 Intel Corporation |
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #include "bvh_builder.h" |
5 | |
6 | namespace embree |
7 | { |
8 | namespace isa |
9 | { |
10 | template<int N> |
11 | typename BVHN<N>::NodeRef BVHNBuilderVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings) |
12 | { |
13 | auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef { |
14 | return createLeaf(prims,set,alloc); |
15 | }; |
16 | |
17 | settings.branchingFactor = N; |
18 | settings.maxDepth = BVH::maxBuildDepthLeaf; |
19 | return BVHBuilderBinnedSAH::build<NodeRef> |
20 | (FastAllocator::Create(allocator),typename BVH::AABBNode::Create2(),typename BVH::AABBNode::Set3(allocator,prims),createLeafFunc,progressFunc,prims,pinfo,settings); |
21 | } |
22 | |
23 | |
24 | template<int N> |
25 | typename BVHN<N>::NodeRef BVHNBuilderQuantizedVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings) |
26 | { |
27 | auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef { |
28 | return createLeaf(prims,set,alloc); |
29 | }; |
30 | |
31 | settings.branchingFactor = N; |
32 | settings.maxDepth = BVH::maxBuildDepthLeaf; |
33 | return BVHBuilderBinnedSAH::build<NodeRef> |
34 | (FastAllocator::Create(allocator),typename BVH::QuantizedNode::Create2(),typename BVH::QuantizedNode::Set2(),createLeafFunc,progressFunc,prims,pinfo,settings); |
35 | } |
36 | |
37 | template<int N> |
38 | typename BVHN<N>::NodeRecordMB BVHNBuilderMblurVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings, const BBox1f& timeRange) |
39 | { |
40 | auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRecordMB { |
41 | return createLeaf(prims,set,alloc); |
42 | }; |
43 | |
44 | settings.branchingFactor = N; |
45 | settings.maxDepth = BVH::maxBuildDepthLeaf; |
46 | return BVHBuilderBinnedSAH::build<NodeRecordMB> |
47 | (FastAllocator::Create(allocator),typename BVH::AABBNodeMB::Create(),typename BVH::AABBNodeMB::SetTimeRange(timeRange),createLeafFunc,progressFunc,prims,pinfo,settings); |
48 | } |
49 | |
50 | template struct BVHNBuilderVirtual<4>; |
51 | template struct BVHNBuilderQuantizedVirtual<4>; |
52 | template struct BVHNBuilderMblurVirtual<4>; |
53 | |
54 | #if defined(__AVX__) |
55 | template struct BVHNBuilderVirtual<8>; |
56 | template struct BVHNBuilderQuantizedVirtual<8>; |
57 | template struct BVHNBuilderMblurVirtual<8>; |
58 | #endif |
59 | } |
60 | } |
61 | |