Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-10-15 00:58:40 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-10-15 01:00:42 +0300
commitbc06fcca47caa182cad0818de6ccb8cde9ea215e (patch)
tree9d4b3e5f24dda41b0d5c70a005cb6b7ec79176c9
parent7a005e089daf068c6b400bfa96ac39d4240f3516 (diff)
Sculpt: do not validate PBVH draw data in mesh_batch_cache_valid
Turns out PBVH drawing and normal mesh batches are not mutually exclusive inside the draw cache; there are edge cases with modifiers and instancing where you need both, and forcing one or the other inside this function leads to memory corruption.
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc b/source/blender/draw/intern/draw_cache_impl_mesh.cc
index d3e071c14e7..5ce658abfe4 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc
@@ -560,16 +560,7 @@ static bool mesh_batch_cache_valid(Object *object, Mesh *me)
return false;
}
- if (object->sculpt && object->sculpt->pbvh) {
- if (cache->pbvh_is_drawing != BKE_pbvh_is_drawing(object->sculpt->pbvh)) {
- return false;
- }
-
- if (BKE_pbvh_is_drawing(object->sculpt->pbvh) &&
- BKE_pbvh_draw_cache_invalid(object->sculpt->pbvh)) {
- return false;
- }
- }
+ /* Note: PBVH draw data should not be checked here. */
if (cache->is_editmode != (me->edit_mesh != nullptr)) {
return false;
@@ -1443,7 +1434,6 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
}
}
-
/* Verify that all surface batches have needed attribute layers.
*/
/* TODO(fclem): We could be a bit smarter here and only do it per
@@ -1486,7 +1476,8 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
mesh_cd_layers_type_merge(&cache->cd_used_over_time, cache->cd_needed);
mesh_cd_layers_type_clear(&cache->cd_needed);
- drw_attributes_merge(&cache->attr_used_over_time, &cache->attr_needed, me->runtime->render_mutex);
+ drw_attributes_merge(
+ &cache->attr_used_over_time, &cache->attr_needed, me->runtime->render_mutex);
drw_attributes_clear(&cache->attr_needed);
}