[Bf-blender-cvs] [d2e60873350] blender-v3.0-release: Fix build error with TBB 2021 and booleans

Brecht Van Lommel noreply at git.blender.org
Sat Nov 27 21:58:19 CET 2021


Commit: d2e608733507add9ecc77c122d9f542a80adccbf
Author: Brecht Van Lommel
Date:   Sat Nov 27 19:07:53 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBd2e608733507add9ecc77c122d9f542a80adccbf

Fix build error with TBB 2021 and booleans

Linux distributions are using newer TBB versions than official releases, and
TBB 2021 is an API breaking release.

In general we should avoid using TBB directly and go through the abstractions
in BLI_task.hh, though there is no abstraction for this.

For 3.0 the safe option is to just not cancel the task but instead early out
in the lambda function. Given the grain size of 2048 there should be no
significant performance difference.

Differential Revision: https://developer.blender.org/D13382

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

M	source/blender/blenlib/intern/mesh_boolean.cc

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

diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc
index 8b029d11c3f..20b696bb56f 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -1370,6 +1370,11 @@ static bool is_pwn(const IMesh &tm, const TriMeshTopology &tmtopo)
   }
 
   threading::parallel_for(tris.index_range(), 2048, [&](IndexRange range) {
+    if (!is_pwn.load()) {
+      /* Early out if mesh is already determined to be non-pwn. */
+      return;
+    }
+
     for (int j : range) {
       const Edge &edge = tris[j].first;
       int tot_orient = 0;
@@ -1395,9 +1400,7 @@ static bool is_pwn(const IMesh &tm, const TriMeshTopology &tmtopo)
           std::cout << "edge causing non-pwn: " << edge << "\n";
         }
         is_pwn = false;
-#  ifdef WITH_TBB
-        tbb::task::self().cancel_group_execution();
-#  endif
+        break;
       }
     }
   });



More information about the Bf-blender-cvs mailing list