initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
115
thirdparty/embree/kernels/bvh/bvh_builder.h
vendored
Normal file
115
thirdparty/embree/kernels/bvh/bvh_builder.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// Copyright 2009-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include "bvh.h"
|
||||
#include "../builders/bvh_builder_sah.h"
|
||||
#include "../builders/bvh_builder_msmblur.h"
|
||||
|
||||
namespace embree
|
||||
{
|
||||
namespace isa
|
||||
{
|
||||
/************************************************************************************/
|
||||
/************************************************************************************/
|
||||
/************************************************************************************/
|
||||
/************************************************************************************/
|
||||
|
||||
template<int N>
|
||||
struct BVHNBuilderVirtual
|
||||
{
|
||||
typedef BVHN<N> BVH;
|
||||
typedef typename BVH::NodeRef NodeRef;
|
||||
typedef FastAllocator::CachedAllocator Allocator;
|
||||
|
||||
struct BVHNBuilderV {
|
||||
NodeRef build(FastAllocator* allocator, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings);
|
||||
virtual NodeRef createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) = 0;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
struct BVHNBuilderT : public BVHNBuilderV
|
||||
{
|
||||
BVHNBuilderT (CreateLeafFunc createLeafFunc)
|
||||
: createLeafFunc(createLeafFunc) {}
|
||||
|
||||
NodeRef createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) {
|
||||
return createLeafFunc(prims,set,alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
CreateLeafFunc createLeafFunc;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
static NodeRef build(FastAllocator* allocator, CreateLeafFunc createLeaf, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings) {
|
||||
return BVHNBuilderT<CreateLeafFunc>(createLeaf).build(allocator,progress,prims,pinfo,settings);
|
||||
}
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct BVHNBuilderQuantizedVirtual
|
||||
{
|
||||
typedef BVHN<N> BVH;
|
||||
typedef typename BVH::NodeRef NodeRef;
|
||||
typedef FastAllocator::CachedAllocator Allocator;
|
||||
|
||||
struct BVHNBuilderV {
|
||||
NodeRef build(FastAllocator* allocator, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings);
|
||||
virtual NodeRef createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) = 0;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
struct BVHNBuilderT : public BVHNBuilderV
|
||||
{
|
||||
BVHNBuilderT (CreateLeafFunc createLeafFunc)
|
||||
: createLeafFunc(createLeafFunc) {}
|
||||
|
||||
NodeRef createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) {
|
||||
return createLeafFunc(prims,set,alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
CreateLeafFunc createLeafFunc;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
static NodeRef build(FastAllocator* allocator, CreateLeafFunc createLeaf, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings) {
|
||||
return BVHNBuilderT<CreateLeafFunc>(createLeaf).build(allocator,progress,prims,pinfo,settings);
|
||||
}
|
||||
};
|
||||
|
||||
template<int N>
|
||||
struct BVHNBuilderMblurVirtual
|
||||
{
|
||||
typedef BVHN<N> BVH;
|
||||
typedef typename BVH::AABBNodeMB AABBNodeMB;
|
||||
typedef typename BVH::NodeRef NodeRef;
|
||||
typedef typename BVH::NodeRecordMB NodeRecordMB;
|
||||
typedef FastAllocator::CachedAllocator Allocator;
|
||||
|
||||
struct BVHNBuilderV {
|
||||
NodeRecordMB build(FastAllocator* allocator, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings, const BBox1f& timeRange);
|
||||
virtual NodeRecordMB createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) = 0;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
struct BVHNBuilderT : public BVHNBuilderV
|
||||
{
|
||||
BVHNBuilderT (CreateLeafFunc createLeafFunc)
|
||||
: createLeafFunc(createLeafFunc) {}
|
||||
|
||||
NodeRecordMB createLeaf (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) {
|
||||
return createLeafFunc(prims,set,alloc);
|
||||
}
|
||||
|
||||
private:
|
||||
CreateLeafFunc createLeafFunc;
|
||||
};
|
||||
|
||||
template<typename CreateLeafFunc>
|
||||
static NodeRecordMB build(FastAllocator* allocator, CreateLeafFunc createLeaf, BuildProgressMonitor& progress, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings, const BBox1f& timeRange) {
|
||||
return BVHNBuilderT<CreateLeafFunc>(createLeaf).build(allocator,progress,prims,pinfo,settings,timeRange);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user