Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-04-01 18:44:08 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-04-01 18:45:59 +0300
commit0f6f9218985957aace8ae2135ac91133fb4370d9 (patch)
treefd2cb217a7f4106301294e8a50b48572cb82d9fa /intern/cycles/bvh/bvh_split.cpp
parent8e6d6cc4dc2b19b6d9db42a1c9057fdf8c6c5404 (diff)
Cycles: Temporarily revert index sort commit for spatial split
There are in fact some missing parts to it (Split BVH builder should be creating bins from result of Object Split constructor). Doable, but need to quickly fix issue for the studio here, easier to revert for now.
Diffstat (limited to 'intern/cycles/bvh/bvh_split.cpp')
-rw-r--r--intern/cycles/bvh/bvh_split.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
index 7ca07675a3a..288cc7e0523 100644
--- a/intern/cycles/bvh/bvh_split.cpp
+++ b/intern/cycles/bvh/bvh_split.cpp
@@ -28,7 +28,7 @@ CCL_NAMESPACE_BEGIN
/* Object Split */
-BVHObjectSplit::BVHObjectSplit(const BVHBuild& builder,
+BVHObjectSplit::BVHObjectSplit(BVHBuild *builder,
BVHSpatialStorage *storage,
const BVHRange& range,
float nodeSAH)
@@ -39,28 +39,21 @@ BVHObjectSplit::BVHObjectSplit(const BVHBuild& builder,
right_bounds(BoundBox::empty),
storage_(storage)
{
- const BVHReference *ref_ptr = &builder.references[range.start()];
+ const BVHReference *ref_ptr = &builder->references[range.start()];
float min_sah = FLT_MAX;
- storage->reference_indices.resize(range.size());
- int *indices = &storage->reference_indices[0];
-
for(int dim = 0; dim < 3; dim++) {
- /* Sort references.
- * We only sort indices, to save amount of memory being sent back
- * and forth.
- */
- bvh_reference_sort_indices(range.start(),
- range.end(),
- &builder.references[0],
- indices,
- dim);
+ /* Sort references. */
+ bvh_reference_sort(range.start(),
+ range.end(),
+ &builder->references[0],
+ dim);
/* sweep right to left and determine bounds. */
BoundBox right_bounds = BoundBox::empty;
for(int i = range.size() - 1; i > 0; i--) {
- right_bounds.grow(ref_ptr[indices[i]].bounds());
+ right_bounds.grow(ref_ptr[i].bounds());
storage_->right_bounds[i - 1] = right_bounds;
}
@@ -68,12 +61,12 @@ BVHObjectSplit::BVHObjectSplit(const BVHBuild& builder,
BoundBox left_bounds = BoundBox::empty;
for(int i = 1; i < range.size(); i++) {
- left_bounds.grow(ref_ptr[indices[i - 1]].bounds());
+ left_bounds.grow(ref_ptr[i - 1].bounds());
right_bounds = storage_->right_bounds[i - 1];
float sah = nodeSAH +
- left_bounds.safe_area() * builder.params.primitive_cost(i) +
- right_bounds.safe_area() * builder.params.primitive_cost(range.size() - i);
+ left_bounds.safe_area() * builder->params.primitive_cost(i) +
+ right_bounds.safe_area() * builder->params.primitive_cost(range.size() - i);
if(sah < min_sah) {
min_sah = sah;