Path: blob/master/thirdparty/embree/kernels/bvh/bvh_builder.cpp
9906 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#include "bvh_builder.h"45namespace embree6{7namespace isa8{9template<int N>10typename BVHN<N>::NodeRef BVHNBuilderVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings)11{12auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef {13return createLeaf(prims,set,alloc);14};1516settings.branchingFactor = N;17settings.maxDepth = BVH::maxBuildDepthLeaf;18return BVHBuilderBinnedSAH::build<NodeRef>19(FastAllocator::Create(allocator),typename BVH::AABBNode::Create2(),typename BVH::AABBNode::Set3(allocator,prims),createLeafFunc,progressFunc,prims,pinfo,settings);20}212223template<int N>24typename BVHN<N>::NodeRef BVHNBuilderQuantizedVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings)25{26auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef {27return createLeaf(prims,set,alloc);28};2930settings.branchingFactor = N;31settings.maxDepth = BVH::maxBuildDepthLeaf;32return BVHBuilderBinnedSAH::build<NodeRef>33(FastAllocator::Create(allocator),typename BVH::QuantizedNode::Create2(),typename BVH::QuantizedNode::Set2(),createLeafFunc,progressFunc,prims,pinfo,settings);34}3536template<int N>37typename BVHN<N>::NodeRecordMB BVHNBuilderMblurVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings, const BBox1f& timeRange)38{39auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRecordMB {40return createLeaf(prims,set,alloc);41};4243settings.branchingFactor = N;44settings.maxDepth = BVH::maxBuildDepthLeaf;45return BVHBuilderBinnedSAH::build<NodeRecordMB>46(FastAllocator::Create(allocator),typename BVH::AABBNodeMB::Create(),typename BVH::AABBNodeMB::SetTimeRange(timeRange),createLeafFunc,progressFunc,prims,pinfo,settings);47}4849template struct BVHNBuilderVirtual<4>;50template struct BVHNBuilderQuantizedVirtual<4>;51template struct BVHNBuilderMblurVirtual<4>;5253#if defined(__AVX__)54template struct BVHNBuilderVirtual<8>;55template struct BVHNBuilderQuantizedVirtual<8>;56template struct BVHNBuilderMblurVirtual<8>;57#endif58}59}606162