diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-22 15:18:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-22 15:18:37 +0400 |
commit | 92a1572102700fe2f03d4de75ac41c10db4621dd (patch) | |
tree | b8ea7a6913fb291227a02bd86ece0648f33c4f69 /intern/cycles/bvh | |
parent | 7d673ef0d2fa934324d2fa9ac5c9efd3d8f61abf (diff) |
fix for rare crash in cycles BVH tree packing.
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp index 4d3588452eb..b58a34f9942 100644 --- a/intern/cycles/bvh/bvh.cpp +++ b/intern/cycles/bvh/bvh.cpp @@ -411,7 +411,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[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 @@ void BVH::pack_instances(size_t nodes_size) /* 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; } |