[Bf-blender-cvs] [686abf18505] blender-v3.2-release: Fix T97853: Crash with edit mode X-ray and subdivision

Hans Goudey noreply at git.blender.org
Mon May 9 17:37:04 CEST 2022


Commit: 686abf1850545f8c953a76791bd098a5259ce0d6
Author: Hans Goudey
Date:   Mon May 9 17:36:54 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB686abf1850545f8c953a76791bd098a5259ce0d6

Fix T97853: Crash with edit mode X-ray and subdivision

The mesh drawing code used a different mesh to check whether or not to
draw face dots and to actually retrieve them. The fix is moving the
responsibility of determining whether to use subsurf face dots to the
creation of `MeshRenderData` where the mesh used for drawing is
known, rather than doing it at a higher level.

Differential Revision: https://developer.blender.org/D14855

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

M	source/blender/draw/intern/draw_cache_extract.h
M	source/blender/draw/intern/draw_cache_extract_mesh.cc
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/intern/draw_cache_impl_subdivision.cc
M	source/blender/draw/intern/draw_subdivision.h

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

diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h
index 4567e470146..cb6006e303a 100644
--- a/source/blender/draw/intern/draw_cache_extract.h
+++ b/source/blender/draw/intern/draw_cache_extract.h
@@ -328,7 +328,6 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
                                         const float obmat[4][4],
                                         bool do_final,
                                         bool do_uvedit,
-                                        bool use_subsurf_fdots,
                                         const Scene *scene,
                                         const struct ToolSettings *ts,
                                         bool use_hide);
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc
index 8a7b4fc9703..ec544d8e786 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc
@@ -563,7 +563,6 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
                                                const float obmat[4][4],
                                                const bool do_final,
                                                const bool do_uvedit,
-                                               const bool use_subsurf_fdots,
                                                const Scene *scene,
                                                const ToolSettings *ts,
                                                const bool use_hide)
@@ -687,7 +686,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
   MeshRenderData *mr = mesh_render_data_create(
       object, me, is_editmode, is_paint_mode, is_mode_active, obmat, do_final, do_uvedit, ts);
   mr->use_hide = use_hide;
-  mr->use_subsurf_fdots = use_subsurf_fdots;
+  mr->use_subsurf_fdots = mr->me && mr->me->runtime.subsurf_face_dot_tags != nullptr;
   mr->use_final_mesh = do_final;
 
 #ifdef DEBUG_TIME
@@ -919,7 +918,6 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
                                         const float obmat[4][4],
                                         const bool do_final,
                                         const bool do_uvedit,
-                                        const bool use_subsurf_fdots,
                                         const Scene *scene,
                                         const ToolSettings *ts,
                                         const bool use_hide)
@@ -935,7 +933,6 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
                                                     obmat,
                                                     do_final,
                                                     do_uvedit,
-                                                    use_subsurf_fdots,
                                                     scene,
                                                     ts,
                                                     use_hide);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 917216b92e6..a406e154fa0 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -2128,8 +2128,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
 
   MDEPS_ASSERT_MAP_INDEX(TRIS_PER_MAT_INDEX);
 
-  const bool use_subsurf_fdots = me->runtime.subsurf_face_dot_tags != NULL;
-
   if (do_uvcage) {
     mesh_buffer_cache_create_requested(task_graph,
                                        cache,
@@ -2142,7 +2140,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
                                        ob->obmat,
                                        false,
                                        true,
-                                       false,
                                        scene,
                                        ts,
                                        true);
@@ -2160,7 +2157,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
                                        ob->obmat,
                                        false,
                                        false,
-                                       use_subsurf_fdots,
                                        scene,
                                        ts,
                                        true);
@@ -2178,7 +2174,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
                            ob->obmat,
                            true,
                            false,
-                           use_subsurf_fdots,
                            ts,
                            use_hide);
   }
@@ -2199,7 +2194,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
                                      ob->obmat,
                                      true,
                                      false,
-                                     use_subsurf_fdots,
                                      scene,
                                      ts,
                                      use_hide);
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 7d245f4158b..8eb0509d615 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -1904,7 +1904,6 @@ static bool draw_subdiv_create_requested_buffers(const Scene *scene,
                                                  const float obmat[4][4],
                                                  const bool do_final,
                                                  const bool do_uvedit,
-                                                 const bool /*use_subsurf_fdots*/,
                                                  const ToolSettings *ts,
                                                  const bool /*use_hide*/,
                                                  OpenSubdiv_EvaluatorCache *evaluator_cache)
@@ -2103,7 +2102,6 @@ void DRW_create_subdivision(const Scene *scene,
                             const float obmat[4][4],
                             const bool do_final,
                             const bool do_uvedit,
-                            const bool use_subsurf_fdots,
                             const ToolSettings *ts,
                             const bool use_hide)
 {
@@ -2128,7 +2126,6 @@ void DRW_create_subdivision(const Scene *scene,
                                             obmat,
                                             do_final,
                                             do_uvedit,
-                                            use_subsurf_fdots,
                                             ts,
                                             use_hide,
                                             g_evaluator_cache)) {
diff --git a/source/blender/draw/intern/draw_subdivision.h b/source/blender/draw/intern/draw_subdivision.h
index d803fad5052..b7cd520f54f 100644
--- a/source/blender/draw/intern/draw_subdivision.h
+++ b/source/blender/draw/intern/draw_subdivision.h
@@ -194,7 +194,6 @@ void DRW_create_subdivision(const struct Scene *scene,
                             const float obmat[4][4],
                             const bool do_final,
                             const bool do_uvedit,
-                            const bool use_subsurf_fdots,
                             const ToolSettings *ts,
                             const bool use_hide);



More information about the Bf-blender-cvs mailing list