Cycles: Optimization to spatial BVH build

Simple fix: release lock earlier.

Reduces spatial split build time from 96 to 53sec on the Bunny.blend
(using studio Intel for benchmark).

NOTE: Timing difference is not that spectacular when comparing numbers
with builds before memory optimization, but even then it's about 20%
faster build.
This commit is contained in:
Sergey Sharybin
2016-04-15 14:27:23 +02:00
parent 10320891f0
commit 3130f4167d

View File

@@ -706,6 +706,7 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
prim_index.resize(range_end);
prim_object.resize(range_end);
}
spatial_spin_lock.unlock();
/* Perform actual data copy. */
if(new_leaf_data_size > 0) {
@@ -713,8 +714,6 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range,
memcpy(&prim_index[start_index], &local_prim_index[0], new_leaf_data_size);
memcpy(&prim_object[start_index], &local_prim_object[0], new_leaf_data_size);
}
spatial_spin_lock.unlock();
}
else {
/* For the regular BVH builder we simply copy new data starting at the