[Bf-blender-cvs] [4ac5859] master: Cycles: Avoid copying objects in some places of BVH build

Sergey Sharybin noreply at git.blender.org
Sun Aug 30 16:50:40 CEST 2015


Commit: 4ac5859f05892cf1456385fe7de3f13debdca858
Author: Sergey Sharybin
Date:   Sun Aug 30 16:47:45 2015 +0200
Branches: master
https://developer.blender.org/rB4ac5859f05892cf1456385fe7de3f13debdca858

Cycles: Avoid copying objects in some places of BVH build

Gives barely measurable speedup of Spatial Split BVH build.

===================================================================

M	intern/cycles/bvh/bvh_binning.cpp
M	intern/cycles/bvh/bvh_split.cpp

===================================================================

diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp
index db96490..8745e39 100644
--- a/intern/cycles/bvh/bvh_binning.cpp
+++ b/intern/cycles/bvh/bvh_binning.cpp
@@ -76,8 +76,8 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
 			prefetch_L2(&prims[start() + i + 8]);
 
 			/* map even and odd primitive to bin */
-			BVHReference prim0 = prims[start() + i + 0];
-			BVHReference prim1 = prims[start() + i + 1];
+			const BVHReference& prim0 = prims[start() + i + 0];
+			const BVHReference& prim1 = prims[start() + i + 1];
 
 			int4 bin0 = get_bin(prim0.bounds());
 			int4 bin1 = get_bin(prim1.bounds());
@@ -96,7 +96,7 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
 		/* for uneven number of primitives */
 		if(i < ssize_t(size())) {
 			/* map primitive to bin */
-			BVHReference prim0 = prims[start() + i];
+			const BVHReference& prim0 = prims[start() + i];
 			int4 bin0 = get_bin(prim0.bounds());
 
 			/* increase bounds of bins */
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
index a697c44..534c1aa 100644
--- a/intern/cycles/bvh/bvh_split.cpp
+++ b/intern/cycles/bvh/bvh_split.cpp
@@ -300,8 +300,8 @@ void BVHSpatialSplit::split_curve_primitive(const Mesh *mesh,
 	/* curve split: NOTE - Currently ignores curve width and needs to be fixed.*/
 	const int k0 = mesh->curves[prim_index].first_key + segment_index;
 	const int k1 = k0 + 1;
-	const float4 key0 = mesh->curve_keys[k0];
-	const float4 key1 = mesh->curve_keys[k1];
+	const float4& key0 = mesh->curve_keys[k0];
+	const float4& key1 = mesh->curve_keys[k1];
 	float3 v0 = float4_to_float3(key0);
 	float3 v1 = float4_to_float3(key1);




More information about the Bf-blender-cvs mailing list