[Bf-blender-cvs] [3ea4ca7b974] soc-2020-soft-body: changing slice a bit
mattoverby
noreply at git.blender.org
Wed Aug 19 20:35:15 CEST 2020
Commit: 3ea4ca7b97409bc88e900fc4b96ddbfd70307a25
Author: mattoverby
Date: Wed Aug 19 13:35:11 2020 -0500
Branches: soc-2020-soft-body
https://developer.blender.org/rB3ea4ca7b97409bc88e900fc4b96ddbfd70307a25
changing slice a bit
===================================================================
M extern/softbody/src/admmpd_collision.cpp
===================================================================
diff --git a/extern/softbody/src/admmpd_collision.cpp b/extern/softbody/src/admmpd_collision.cpp
index 1c42a7b1b19..061369b993b 100644
--- a/extern/softbody/src/admmpd_collision.cpp
+++ b/extern/softbody/src/admmpd_collision.cpp
@@ -315,12 +315,18 @@ int EmbeddedMeshCollision::detect(
const auto & per_thread_function = [&per_embedded_vertex_detect,&max_threads,&nev]
(DetectThreadData *td, int thread_idx)
{
- int slice = std::max((int)std::round((nev+1)/double(max_threads)),1);
+ float slice_f = float(nev+1) / float(max_threads);
+ int slice = std::max((int)std::ceil(slice_f),1);
for (int i=0; i<slice; ++i)
{
int vi = i*max_threads + thread_idx;
- if (vi >= nev)
+
+ // Yeah okay I know this is dumb and I can just do a better job
+ // of calculating the slice. We can save thread optimization
+ // for the future, since this will be written different anyway.
+ if (vi >= nev) {
break;
+ }
per_embedded_vertex_detect(td,thread_idx,vi);
}
More information about the Bf-blender-cvs
mailing list