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
committerPhilipp Oeser <info@graphics-engineer.com>2022-03-31 14:01:12 +0300
commitf88646a1edcc69f216e59ee54d8555f7e3e2c9c6 (patch)
tree49c95695b0854afe44a4536ec0539beb8c0b00e8
parentccecd97c8c41e32f0c4212c48195f80163e850ab (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
-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 a47a124bd24..908084df789 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
@@ -477,7 +477,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);