diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-23 16:57:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-24 10:46:41 +0300 |
commit | 2960630b7bb2c5a131cce7b86fbd55bfa94cb369 (patch) | |
tree | 4bdf71d3f62b4d9e22ae2d829b230525d8022266 | |
parent | 7be6dba091d600c0a4fd327cebe9651721e1307b (diff) |
Cycles: Use better policy for primitive array resize for spatial split
Gives around 50% of spatial split BVH build speedup with grass field from
cassette player shot from Gooseberry.
-rw-r--r-- | intern/cycles/bvh/bvh_build.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 13427516b01..45b0aaa2d63 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -533,11 +533,9 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range) /* Extend an array when needed. */ if(prim_type.size() < range.end()) { assert(params.use_spatial_split); - /* TODO(sergey): We might want to look into different policies of - * re-allocation here, so on the one hand we would not do as much - * re-allocations and on the other hand will have small memory - * overhead. - */ + prim_type.reserve(references.size()); + prim_index.reserve(references.size()); + prim_object.reserve(references.size()); prim_type.resize(range.end()); prim_index.resize(range.end()); prim_object.resize(range.end()); |