Commit: 7ce61c64cf92165923e8653c76a6b7fcb1322666
Author: Bastien Montagne
Date: Tue Jan 26 14:30:44 2016 +0100
Branches: master
https://developer.blender.org/rB7ce61c64cf92165923e8653c76a6b7fcb1322666
Cleanup: remove OMP's 'critical' sections in
BKE_pbvh_node_add_proxy/free_proxies.
Not so useful now that we use BLI_task! Not sure why those were ever added
actually,
readng carefully that code only modified data here is the PBVHNode, which is
only
used/affected by one thread at a time ever. And shared read data (PBVH itself)
is
not modified during brush execution itself, so it's safe to use it threaded too.
===================================================================
M source/blender/blenkernel/intern/pbvh.c
===================================================================
diff --git a/source/blender/blenkernel/intern/pbvh.c
b/source/blender/blenkernel/intern/pbvh.c
index 9b7bc27..ba56af8 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1906,38 +1906,32 @@ PBVHProxyNode *BKE_pbvh_node_add_proxy(PBVH *bvh,
PBVHNode *node)
{
int index, totverts;
-#pragma omp critical
- {
- index = node->proxy_count;
+ index = node->proxy_count;
- node->proxy_count++;
+ node->proxy_count++;
- if (node->proxies)
- node->proxies = MEM_reallocN(node->proxies,
node->proxy_count * sizeof(PBVHProxyNode));
- else
- node->proxies = MEM_mallocN(sizeof(PBVHProxyNode),
"PBVHNodeProxy");
+ if (node->proxies)
+ node->proxies = MEM_reallocN(node->proxies, node->proxy_count *
sizeof(PBVHProxyNode));
+ else
+ node->proxies = MEM_mallocN(sizeof(PBVHProxyNode),
"PBVHNodeProxy");
- BKE_pbvh_node_num_verts(bvh, node, &totverts, NULL);
- node->proxies[index].co = MEM_callocN(sizeof(float[3]) *
totverts, "PBVHNodeProxy.co");
- }
+ BKE_pbvh_node_num_verts(bvh, node, &totverts, NULL);
+ node->proxies[index].co = MEM_callocN(sizeof(float[3]) * totverts,
"PBVHNodeProxy.co");
return node->proxies + index;
}
void BKE_pbvh_node_free_proxies(PBVHNode *node)
{
-#pragma omp critical
- {
- for (int p = 0; p < node->proxy_count; p++) {
- MEM_freeN(node->proxies[p].co);
- node->proxies[p].co = NULL;
- }
+ for (int p = 0; p < node->proxy_count; p++) {
+ MEM_freeN(node->proxies[p].co);
+ node->proxies[p].co = NULL;
+ }
- MEM_freeN(node->proxies);
- node->proxies = NULL;
+ MEM_freeN(node->proxies);
+ node->proxies = NULL;
- node->proxy_count = 0;
- }
+ node->proxy_count = 0;
}
void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs