diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-08 20:10:32 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-01-09 14:14:20 +0300 |
commit | 8044e5f2d771a1c3ee1a116132ddc09ce3452cbb (patch) | |
tree | a30b0f3f2e90b197e9ebaebae6ceab108d9548d2 /intern/cycles/bvh/bvh2.cpp | |
parent | b486088218f66810b97294f38f246e4650d32f2b (diff) |
Cycles: Make BVH wider prior to packing
This allows to do more non-trivial tree modifications to make
it more dense and more friendly for vectorization.
Diffstat (limited to 'intern/cycles/bvh/bvh2.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh2.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/intern/cycles/bvh/bvh2.cpp b/intern/cycles/bvh/bvh2.cpp index 4a423c16559..e5dc4e6b1a8 100644 --- a/intern/cycles/bvh/bvh2.cpp +++ b/intern/cycles/bvh/bvh2.cpp @@ -30,6 +30,11 @@ BVH2::BVH2(const BVHParams& params_, const vector<Object*>& objects_) { } +BVHNode *BVH2::widen_children_nodes(const BVHNode *root) +{ + return const_cast<BVHNode *>(root); +} + void BVH2::pack_leaf(const BVHStackEntry& e, const LeafNode *leaf) { @@ -188,9 +193,8 @@ void BVH2::pack_nodes(const BVHNode *root) } else { stack.push_back(BVHStackEntry(root, nextNodeIdx)); - nextNodeIdx += node_is_unaligned(root, bvh2) - ? BVH_UNALIGNED_NODE_SIZE - : BVH_NODE_SIZE; + nextNodeIdx += root->has_unaligned() ? BVH_UNALIGNED_NODE_SIZE + : BVH_NODE_SIZE; } while(stack.size()) { @@ -203,7 +207,7 @@ void BVH2::pack_nodes(const BVHNode *root) pack_leaf(e, leaf); } else { - /* innner node */ + /* inner node */ int idx[2]; for(int i = 0; i < 2; ++i) { if(e.node->get_child(i)->is_leaf()) { @@ -211,7 +215,7 @@ void BVH2::pack_nodes(const BVHNode *root) } else { idx[i] = nextNodeIdx; - nextNodeIdx += node_is_unaligned(e.node->get_child(i), bvh2) + nextNodeIdx += e.node->get_child(i)->has_unaligned() ? BVH_UNALIGNED_NODE_SIZE : BVH_NODE_SIZE; } |