[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50111] trunk/blender/intern/cycles/bvh/ bvh.cpp: fix for rare crash in cycles BVH tree packing.

Campbell Barton ideasman42 at gmail.com
Wed Aug 22 13:18:37 CEST 2012


Revision: 50111
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50111
Author:   campbellbarton
Date:     2012-08-22 11:18:37 +0000 (Wed, 22 Aug 2012)
Log Message:
-----------
fix for rare crash in cycles BVH tree packing.

Modified Paths:
--------------
    trunk/blender/intern/cycles/bvh/bvh.cpp

Modified: trunk/blender/intern/cycles/bvh/bvh.cpp
===================================================================
--- trunk/blender/intern/cycles/bvh/bvh.cpp	2012-08-22 10:29:30 UTC (rev 50110)
+++ trunk/blender/intern/cycles/bvh/bvh.cpp	2012-08-22 11:18:37 UTC (rev 50111)
@@ -411,7 +411,7 @@
 			size_t nsize_bbox = (use_qbvh)? nsize-2: nsize-1;
 			int4 *bvh_nodes = &bvh->pack.nodes[0];
 			size_t bvh_nodes_size = bvh->pack.nodes.size(); 
-			int *bvh_is_leaf = &bvh->pack.is_leaf[0];
+			int *bvh_is_leaf = (bvh->pack.is_leaf.size() != 0) ? &bvh->pack.is_leaf[0] : NULL;
 
 			for(size_t i = 0, j = 0; i < bvh_nodes_size; i+=nsize, j++) {
 				memcpy(pack_nodes + pack_nodes_offset, bvh_nodes + i, nsize_bbox*sizeof(int4));
@@ -419,7 +419,7 @@
 				/* modify offsets into arrays */
 				int4 data = bvh_nodes[i + nsize_bbox];
 
-				if(bvh_is_leaf[j]) {
+				if(bvh_is_leaf && bvh_is_leaf[j]) {
 					data.x += tri_offset;
 					data.y += tri_offset;
 				}




More information about the Bf-blender-cvs mailing list