[Bf-blender-cvs] [2f4aef9] master: Cycles: Avoid crash in statistics when canceling BVH build

Sergey Sharybin noreply at git.blender.org
Mon Jan 19 09:42:54 CET 2015


Commit: 2f4aef9f3bc1880496d5a8f1a23992f8a03d0af5
Author: Sergey Sharybin
Date:   Mon Jan 19 13:39:35 2015 +0500
Branches: master
https://developer.blender.org/rB2f4aef9f3bc1880496d5a8f1a23992f8a03d0af5

Cycles: Avoid crash in statistics when canceling BVH build

Also add missing render_time initialization in progress.

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

M	intern/cycles/bvh/bvh_build.cpp
M	intern/cycles/util/util_progress.h

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

diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 32946c8..e248040 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -268,21 +268,22 @@ BVHNode* BVHBuild::run()
 		if(progress.get_cancel()) {
 			rootnode->deleteSubtree();
 			rootnode = NULL;
+			VLOG(1) << "BVH build cancelled.";
 		}
 		else if(!params.use_spatial_split) {
 			/*rotate(rootnode, 4, 5);*/
 			rootnode->update_visibility();
+			VLOG(1) << "BVH build statistics:\n"
+			        << "  Build time: " << time_dt() - build_start_time << "\n"
+			        << "  Total number of nodes: "
+			        << rootnode->getSubtreeSize(BVH_STAT_NODE_COUNT) << "\n"
+			        << "  Number of inner nodes: "
+			        << rootnode->getSubtreeSize(BVH_STAT_INNER_COUNT)  << "\n"
+			        << "  Number of leaf nodes: "
+			        << rootnode->getSubtreeSize(BVH_STAT_LEAF_COUNT)  << "\n";
 		}
 	}
 
-	VLOG(1) << "BVH build statistics:\n"
-	        << "  Build time: " << time_dt() - build_start_time << "\n"
-	        << "  Total number of nodes: "
-	        << rootnode->getSubtreeSize(BVH_STAT_NODE_COUNT) << "\n"
-	        << "  Number of inner nodes: "
-	        << rootnode->getSubtreeSize(BVH_STAT_INNER_COUNT)  << "\n"
-	        << "  Number of leaf nodes: "
-	        << rootnode->getSubtreeSize(BVH_STAT_LEAF_COUNT)  << "\n";
 
 	return rootnode;
 }
diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h
index 315aa75..0ff4863 100644
--- a/intern/cycles/util/util_progress.h
+++ b/intern/cycles/util/util_progress.h
@@ -38,6 +38,7 @@ public:
 		sample = 0;
 		start_time = time_dt();
 		total_time = 0.0f;
+		render_time = 0.0f;
 		tile_time = 0.0f;
 		status = "Initializing";
 		substatus = "";




More information about the Bf-blender-cvs mailing list