diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-29 18:22:50 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-29 18:22:50 +0300 |
commit | 03acbc7b71ac1ea64be05332dc19c1c11a1b818f (patch) | |
tree | 506e88115444d928f578e61c0a7fc8bcb3ab2e6a /source/blender/blenkernel | |
parent | b9c7c904ede17afc3861a2d58d1ac65a6e87f664 (diff) | |
parent | 54a2fcc0f331b8971e8a105382e9a8f67e1859e3 (diff) |
Merge branch 'blender-v2.90-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 93794eb9709..bea8fdd5719 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -717,11 +717,14 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data, /* printf("BVHTree built and saved on cache\n"); */ BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_verts_setup_data(data, tree, in_cache, vert, vert_allocated); @@ -929,11 +932,14 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data, /* Save on cache for later use */ /* printf("BVHTree built and saved on cache\n"); */ bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_edges_setup_data( data, tree, in_cache, vert, vert_allocated, edge, edge_allocated); @@ -1058,11 +1064,14 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data, /* printf("BVHTree built and saved on cache\n"); */ BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_faces_setup_data( data, tree, in_cache, vert, vert_allocated, face, face_allocated); @@ -1298,11 +1307,14 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data, if (bvh_cache_p) { BVHCache *bvh_cache = *bvh_cache_p; bvhcache_insert(bvh_cache, tree, bvh_cache_type); - bvhcache_unlock(bvh_cache, lock_started); in_cache = true; } } + if (bvh_cache_p) { + bvhcache_unlock(*bvh_cache_p, lock_started); + } + /* Setup BVHTreeFromMesh */ bvhtree_from_mesh_looptri_setup_data(data, tree, @@ -1428,8 +1440,6 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, mesh->medge, mesh->totedge, mesh->mvert, verts_len, &loose_vert_len); } - /* TODO: a global mutex lock held during the expensive operation of - * building the BVH tree is really bad for performance. */ tree = bvhtree_from_mesh_verts_ex(data, mesh->mvert, verts_len, |