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
This commit is contained in:
Hans Goudey 2022-05-09 17:36:54 +02:00
parent 43e31d26a9
commit 686abf1850
Notes: blender-bot 2023-02-13 15:32:18 +01:00
Referenced by issue #97853, Crash upon entering Edit Mode and toggling X-Ray
5 changed files with 1 additions and 15 deletions

View File

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

View File

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

View File

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

View File

@ -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)) {

View File

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