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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2022-03-30 18:31:40 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2022-03-30 18:31:40 +0300
commitba28c10199b363df469cf70f2e9436be90deb258 (patch)
tree226ba0f922c360a10dbd67b2163ca5bbb59c0db0 /source/blender/draw/intern
parent9b9fda2122ae38ae6f92f31a21674c55a5a52295 (diff)
Fix T96344: edit mode GPU subdivision crashes with X-ray mode and modifiers
The crash happens because the origindex layers created as part of the modifier stack evaluation are not set in the `MeshRenderData` when they should have been. This is because when selecting in X-ray mode, a subdivision wrapper is created to ensure that selection happens with a subdivided geometry, and this replaces the `MDATA` wrapper which is also used to setup the `MeshRenderData`. As we do not seemingly have an `MDATA` wrapper, the draw code decides that we can extract draw buffers directly from the BMesh, instead of the mapped Mesh with origin indices layers. To fix this, we should also consider to use mapped extraction if a subdivision wrapper exists on the mesh. Differential Revision: https://developer.blender.org/D14485
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh_render_data.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c
index a2995d6cd3f..0a93f346b37 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c
+++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c
@@ -461,7 +461,14 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->bm_poly_centers = mr->edit_data->polyCos;
}
- bool has_mdata = is_mode_active && (mr->me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA);
+ /* A subdivision wrapper may be created in edit mode when X-ray is turned on to ensure that the
+ * topology seen by the user matches the one used for the selection routines. This wrapper
+ * seemingly takes precedence over the MDATA one, however the mesh we use for rendering is not
+ * the subdivided one, but the one where the MDATA wrapper would have been added. So consider
+ * the subdivision wrapper as well for the `has_mdata` case. */
+ bool has_mdata = is_mode_active && ELEM(mr->me->runtime.wrapper_type,
+ ME_WRAPPER_TYPE_MDATA,
+ ME_WRAPPER_TYPE_SUBD);
bool use_mapped = is_mode_active &&
(has_mdata && !do_uvedit && mr->me && !mr->me->runtime.is_original);