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
This commit is contained in:
Brecht Van Lommel 2021-11-27 19:07:53 +01:00 committed by Brecht Van Lommel
parent 2fb8c6805a
commit d2e6087335
Notes: blender-bot 2023-02-14 03:03:03 +01:00
Referenced by issue #93454, blender 3.0 Line art rendering is very slow.
Referenced by issue #93449, blender-3.0. beta  can't  setting  Cycles Render devices
Referenced by issue #93439, Armature widgets from hidden collections are invisible.
Referenced by issue #90063, Regression: Set curve radius does not work
1 changed files with 6 additions and 3 deletions

View File

@ -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;
}
}
});