[Bf-blender-cvs] [2960630] master: Cycles: Use better policy for primitive array resize for spatial split

Sergey Sharybin noreply at git.blender.org
Mon Aug 24 09:59:01 CEST 2015


Commit: 2960630b7bb2c5a131cce7b86fbd55bfa94cb369
Author: Sergey Sharybin
Date:   Sun Aug 23 15:57:41 2015 +0200
Branches: master
https://developer.blender.org/rB2960630b7bb2c5a131cce7b86fbd55bfa94cb369

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.

===================================================================

M	intern/cycles/bvh/bvh_build.cpp

===================================================================

diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 1342751..45b0aaa 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());




More information about the Bf-blender-cvs mailing list