[Bf-blender-cvs] [76a4cf1941] master: Cycles: Use separate limit for motion primitives for BVH node limits

Sergey Sharybin noreply at git.blender.org
Thu Jan 12 18:27:27 CET 2017


Commit: 76a4cf1941ef0f1e8ca2dd641fb94703dce5a9b0
Author: Sergey Sharybin
Date:   Thu Jan 12 16:54:08 2017 +0100
Branches: master
https://developer.blender.org/rB76a4cf1941ef0f1e8ca2dd641fb94703dce5a9b0

Cycles: Use separate limit for motion primitives for BVH node limits

This way we can have different limits for regular and motion curves
which we'll do in one of the upcoming commits in order to gain some
percents of speedup.

The reasoning here is that motion curves are usually intersecting
lots of others bounding boxes, which makes it inefficient to have
single primitive in the leaf node.

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

M	intern/cycles/bvh/bvh_build.cpp
M	intern/cycles/bvh/bvh_params.h

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

diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index d283cdaf9d..48f1d063fd 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -435,6 +435,7 @@ bool BVHBuild::range_within_max_leaf_size(const BVHRange& range,
 		return false;
 
 	size_t num_triangles = 0;
+	size_t num_motion_triangles = 0;
 	size_t num_curves = 0;
 	size_t num_motion_curves = 0;
 
@@ -445,13 +446,16 @@ bool BVHBuild::range_within_max_leaf_size(const BVHRange& range,
 			num_curves++;
 		if(ref.prim_type() & PRIMITIVE_MOTION_CURVE)
 			num_motion_curves++;
-		else if(ref.prim_type() & PRIMITIVE_ALL_TRIANGLE)
+		else if(ref.prim_type() & PRIMITIVE_TRIANGLE)
 			num_triangles++;
+		else if(ref.prim_type() & PRIMITIVE_MOTION_TRIANGLE)
+			num_motion_triangles++;
 	}
 
 	return (num_triangles <= params.max_triangle_leaf_size) &&
+	       (num_motion_triangles <= params.max_motion_triangle_leaf_size) &&
 	       (num_curves <= params.max_curve_leaf_size) &&
-	       (num_motion_curves <= params.max_curve_leaf_size);
+	       (num_motion_curves <= params.max_motion_curve_leaf_size);
 }
 
 /* multithreaded binning builder */
diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index 431e42a0d6..38a2e557a5 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -43,7 +43,9 @@ public:
 	/* number of primitives in leaf */
 	int min_leaf_size;
 	int max_triangle_leaf_size;
+	int max_motion_triangle_leaf_size;
 	int max_curve_leaf_size;
+	int max_motion_curve_leaf_size;
 
 	/* object or mesh level bvh */
 	bool top_level;
@@ -80,7 +82,9 @@ public:
 
 		min_leaf_size = 1;
 		max_triangle_leaf_size = 8;
+		max_motion_triangle_leaf_size = 8;
 		max_curve_leaf_size = 1;
+		max_motion_curve_leaf_size = 1;
 
 		top_level = false;
 		use_qbvh = false;




More information about the Bf-blender-cvs mailing list