[Bf-blender-cvs] [8495f9e73d7] soc-2019-embree-gpu: Allow to build empty tree
MATILLAT Quentin
noreply at git.blender.org
Tue Aug 27 16:48:08 CEST 2019
Commit: 8495f9e73d7db4a239d64c0ac43af95ba0fa54ae
Author: MATILLAT Quentin
Date: Tue Aug 27 16:32:22 2019 +0200
Branches: soc-2019-embree-gpu
https://developer.blender.org/rB8495f9e73d7db4a239d64c0ac43af95ba0fa54ae
Allow to build empty tree
===================================================================
M intern/cycles/bvh/bvh_embree_converter.cpp
===================================================================
diff --git a/intern/cycles/bvh/bvh_embree_converter.cpp b/intern/cycles/bvh/bvh_embree_converter.cpp
index 969e941fafa..ed6bc66d02b 100644
--- a/intern/cycles/bvh/bvh_embree_converter.cpp
+++ b/intern/cycles/bvh/bvh_embree_converter.cpp
@@ -366,6 +366,7 @@ BVHNode* BVHEmbreeConverter::getBVH4()
BVHNode* BVHEmbreeConverter::getBVH2()
{
BVHNode *root = this->getBVH4();
+ if(root == nullptr) return nullptr;
return bvh_shrink(root);
}
@@ -777,6 +778,12 @@ void BVHEmbreeConverter::fillPack(PackedBVH &pack) {
this->pack = &pack;
BVHNode *root = this->getBVH2();
+ if(root == nullptr) {
+ pack.root_index = 0;
+ pack.nodes.clear();
+ pack.leaf_nodes.clear();
+ return;
+ }
const size_t num_nodes = root->getSubtreeSize(BVH_STAT_NODE_COUNT);
const size_t num_leaf_nodes = root->getSubtreeSize(BVH_STAT_LEAF_COUNT);
More information about the Bf-blender-cvs
mailing list