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.
This commit is contained in:
Sergey Sharybin 2015-08-23 15:57:41 +02:00
parent 7be6dba091
commit 2960630b7b
1 changed files with 3 additions and 5 deletions

View File

@ -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());