forked from bartvdbraak/blender
Cycles: Avoid per-split memory allocation for the new references list
This commit is contained in:
parent
e69a0ab5fc
commit
63d017be90
@ -186,6 +186,7 @@ struct BVHSpatialStorage {
|
|||||||
vector<BoundBox> spatial_right_bounds;
|
vector<BoundBox> spatial_right_bounds;
|
||||||
BVHSpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
|
BVHSpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
|
||||||
vector<int> spatial_indices;
|
vector<int> spatial_indices;
|
||||||
|
vector<BVHReference> spatial_new_refs;
|
||||||
};
|
};
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@ -220,7 +220,8 @@ void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right,
|
|||||||
* Duplication happens into a temporary pre-allocated vector in order to
|
* Duplication happens into a temporary pre-allocated vector in order to
|
||||||
* reduce number of memmove() calls happening in vector.insert().
|
* 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);
|
new_refs.reserve(right_start - left_end);
|
||||||
while(left_end < right_start) {
|
while(left_end < right_start) {
|
||||||
/* split reference. */
|
/* split reference. */
|
||||||
|
Loading…
Reference in New Issue
Block a user