From 0f6f9218985957aace8ae2135ac91133fb4370d9 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 1 Apr 2016 17:44:08 +0200 Subject: 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. --- intern/cycles/bvh/bvh_split.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'intern/cycles/bvh/bvh_split.cpp') 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; -- cgit v1.2.3