diff options
author | Patrick Mours <pmours@nvidia.com> | 2019-08-26 18:29:06 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-26 18:39:57 +0300 |
commit | f6da680946e2bf982c4831c2135305cb0674215f (patch) | |
tree | 761f97b6ba45bd5f2e394dac10a276c0e0c23bf8 /intern/cycles/bvh/bvh_embree.cpp | |
parent | 2dd1e6b376bf6b275f7b0053dae3910afb1c924a (diff) |
Cycles: refactor of BVH building to prepare for Optix
Ref D5363
Diffstat (limited to 'intern/cycles/bvh/bvh_embree.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_embree.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index b011bc63dbd..d12a0c137ea 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -285,8 +285,10 @@ RTCDevice BVHEmbree::rtc_shared_device = NULL; int BVHEmbree::rtc_shared_users = 0; thread_mutex BVHEmbree::rtc_shared_mutex; -BVHEmbree::BVHEmbree(const BVHParams ¶ms_, const vector<Object *> &objects_) - : BVH(params_, objects_), +BVHEmbree::BVHEmbree(const BVHParams ¶ms_, + const vector<Mesh *> &meshes_, + const vector<Object *> &objects_) + : BVH(params_, meshes_, objects_), scene(NULL), mem_used(0), top_level(NULL), @@ -497,6 +499,11 @@ void BVHEmbree::build(Progress &progress, Stats *stats_) stats = NULL; } +void BVHEmbree::copy_to_device(Progress & /*progress*/, DeviceScene *dscene) +{ + dscene->data.bvh.scene = scene; +} + BVHNode *BVHEmbree::widen_children_nodes(const BVHNode * /*root*/) { assert(!"Must not be called."); @@ -840,7 +847,7 @@ void BVHEmbree::pack_nodes(const BVHNode *) Mesh *mesh = ob->mesh; BVH *bvh = mesh->bvh; - if (mesh->need_build_bvh()) { + if (mesh->need_build_bvh(BVH_LAYOUT_EMBREE)) { if (mesh_map.find(mesh) == mesh_map.end()) { prim_index_size += bvh->pack.prim_index.size(); prim_tri_verts_size += bvh->pack.prim_tri_verts.size(); @@ -872,7 +879,7 @@ void BVHEmbree::pack_nodes(const BVHNode *) /* We assume that if mesh doesn't need own BVH it was already included * into a top-level BVH and no packing here is needed. */ - if (!mesh->need_build_bvh()) { + if (!mesh->need_build_bvh(BVH_LAYOUT_EMBREE)) { pack.object_node[object_offset++] = prim_offset; continue; } |