[Bf-blender-cvs] [77f3d2b4233] sculpt-dev: Sculpt: Add various checks to detect NaNs

Joseph Eagar noreply at git.blender.org
Fri Oct 15 05:14:01 CEST 2021


Commit: 77f3d2b423357f0090c5ae22a8ecdd1a6e85ef38
Author: Joseph Eagar
Date:   Thu Oct 14 20:11:36 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB77f3d2b423357f0090c5ae22a8ecdd1a6e85ef38

Sculpt: Add various checks to detect NaNs

Most of this commit made it in one or two commits ago.
Added a little macro to detect mysterious NaNs reported
by users and that appear to be related to threading.

It's seeded in various places to hopefully catch
where this is happening.

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

M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 6ad699b301e..93ccc1cc757 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -1095,6 +1095,8 @@ static void pbvh_update_normals_task_cb(void *__restrict userdata,
     int ni2 = BM_ELEM_CD_GET_INT(v, data->cd_vert_node_offset);
     bool bad = ni2 != node_nr || (mv->flag & SCULPTVERT_PBVH_BOUNDARY);
 
+    PBVH_CHECK_NAN(v->no);
+
     if (bad) {
       BLI_array_append(bordervs, v);
     }
@@ -1106,12 +1108,17 @@ static void pbvh_update_normals_task_cb(void *__restrict userdata,
 
   TGSET_ITER (f, node->bm_faces) {
     BM_face_normal_update(f);
+
+    PBVH_CHECK_NAN(f->no);
+
     BMLoop *l = f->l_first;
     do {
       MSculptVert *mv = BKE_PBVH_SCULPTVERT(data->cd_sculpt_vert, l->v);
       int ni2 = BM_ELEM_CD_GET_INT(l->v, data->cd_vert_node_offset);
       bool bad = ni2 != node_nr || (mv->flag & SCULPTVERT_PBVH_BOUNDARY);
 
+      PBVH_CHECK_NAN(l->v->no);
+
       if (!bad) {
         add_v3_v3(l->v->no, f->no);
       }
@@ -1124,6 +1131,8 @@ static void pbvh_update_normals_task_cb(void *__restrict userdata,
     int ni2 = BM_ELEM_CD_GET_INT(v, data->cd_vert_node_offset);
     bool bad = ni2 != node_nr || (mv->flag & SCULPTVERT_PBVH_BOUNDARY);
 
+    PBVH_CHECK_NAN(v->no);
+
     if (!bad) {
       normalize_v3(v->no);
     }
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index fa8344f953f..4b7003e4b2f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -10187,6 +10187,8 @@ static void sculpt_combine_proxies_task_cb(void *__restrict userdata,
       add_v3_v3(val, proxies[p].co[vd.i]);
     }
 
+    PBVH_CHECK_NAN(val);
+
     if (ss->filter_cache && ss->filter_cache->cloth_sim) {
       /* When there is a simulation running in the filter cache that was created by a tool, combine
        * the proxies into the simulation instead of directly into the mesh. */



More information about the Bf-blender-cvs mailing list