Mesh: Multithreaded transformation apply #115021
|
@ -1717,7 +1717,11 @@ float (*BKE_mesh_vert_coords_alloc(const Mesh *mesh, int *r_vert_len))[3]
|
||||||
void BKE_mesh_vert_coords_apply(Mesh *mesh, const float (*vert_coords)[3])
|
void BKE_mesh_vert_coords_apply(Mesh *mesh, const float (*vert_coords)[3])
|
||||||
{
|
{
|
||||||
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
||||||
for (const int i : positions.index_range()) {
|
const int size = mesh->totvert;
|
||||||
|
#ifdef WITH_OMP
|
||||||
|
#pragma omp parallel for
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
|||||||
copy_v3_v3(positions[i], vert_coords[i]);
|
copy_v3_v3(positions[i], vert_coords[i]);
|
||||||
}
|
}
|
||||||
BKE_mesh_tag_positions_changed(mesh);
|
BKE_mesh_tag_positions_changed(mesh);
|
||||||
|
@ -1728,7 +1732,11 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
|
||||||
const float mat[4][4])
|
const float mat[4][4])
|
||||||
{
|
{
|
||||||
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
MutableSpan<float3> positions = mesh->vert_positions_for_write();
|
||||||
for (const int i : positions.index_range()) {
|
const int size = mesh->totvert;
|
||||||
|
#ifdef WITH_OMP
|
||||||
|
#pragma omp parallel for
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
mul_v3_m4v3(positions[i], mat, vert_coords[i]);
|
mul_v3_m4v3(positions[i], mat, vert_coords[i]);
|
||||||
}
|
}
|
||||||
BKE_mesh_tag_positions_changed(mesh);
|
BKE_mesh_tag_positions_changed(mesh);
|
||||||
|
|
Loading…
Reference in New Issue
Please, check
threading::parallel_for()
(fromBLI_task.hh
) use case instead ofWITH_OMP
.the function being run is a lambda expression which is not compatible with it
Why?
i have no idea
Just as example https://projects.blender.org/blender/blender/src/branch/main/source/blender/blenkernel/intern/mesh.cc#L1534
oh, i see where i went wrong, i was trying to replace the for loop with threading::parallel_for()