[Bf-blender-cvs] [2c33130] soc-2014-cycles: Cycles: Use bool for is_leaf bvh property.

Thomas Dinges noreply at git.blender.org
Wed Aug 6 00:41:12 CEST 2014


Commit: 2c331302773bfbd725c1a9a102b7e637a46a2a2f
Author: Thomas Dinges
Date:   Wed Aug 6 00:39:40 2014 +0200
Branches: soc-2014-cycles
https://developer.blender.org/rB2c331302773bfbd725c1a9a102b7e637a46a2a2f

Cycles: Use bool for is_leaf bvh property.

* This is not actually copied to the device, so we can use a bool here, which is smaller than a int.

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

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

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

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 3c0c5c0..a2c6733 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -497,7 +497,7 @@ void BVH::pack_instances(size_t nodes_size)
 			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.size() != 0) ? &bvh->pack.is_leaf[0] : NULL;
+			bool *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));
diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h
index 5fcaaaa..97c5ebd 100644
--- a/intern/cycles/bvh/bvh.h
+++ b/intern/cycles/bvh/bvh.h
@@ -63,7 +63,7 @@ struct PackedBVH {
 	array<int> prim_object;
 	/* quick array to lookup if a node is a leaf, not used for traversal, only
 	 * for instance BVH merging  */
-	array<int> is_leaf;
+	array<bool> is_leaf;
 
 	/* index of the root node. */
 	int root_index;




More information about the Bf-blender-cvs mailing list