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.
This commit is contained in:
Joseph Eagar 2021-10-14 20:11:36 -07:00
parent 151df9b3fc
commit 77f3d2b423
2 changed files with 11 additions and 0 deletions

View File

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

View File

@ -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. */