[Bf-blender-cvs] [63d017b] master: Cycles: Avoid per-split memory allocation for the new references list
Sergey Sharybin
noreply at git.blender.org
Thu Mar 31 10:23:30 CEST 2016
Commit: 63d017be90aef79492cae298e4c6add9abae067f
Author: Sergey Sharybin
Date: Sun Feb 21 16:46:16 2016 +0100
Branches: master
https://developer.blender.org/rB63d017be90aef79492cae298e4c6add9abae067f
Cycles: Avoid per-split memory allocation for the new references list
===================================================================
M intern/cycles/bvh/bvh_params.h
M intern/cycles/bvh/bvh_split.cpp
===================================================================
diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index 2b280d6..2e579ba 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -186,6 +186,7 @@ struct BVHSpatialStorage {
vector<BoundBox> spatial_right_bounds;
BVHSpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
vector<int> spatial_indices;
+ vector<BVHReference> spatial_new_refs;
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
index cafee25..5d33238 100644
--- a/intern/cycles/bvh/bvh_split.cpp
+++ b/intern/cycles/bvh/bvh_split.cpp
@@ -220,7 +220,8 @@ void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right,
* Duplication happens into a temporary pre-allocated vector in order to
* reduce number of memmove() calls happening in vector.insert().
*/
- vector<BVHReference> new_refs;
+ vector<BVHReference>& new_refs = storage_->spatial_new_refs;
+ new_refs.clear();
new_refs.reserve(right_start - left_end);
while(left_end < right_start) {
/* split reference. */
More information about the Bf-blender-cvs
mailing list