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

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