diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-02-14 12:09:06 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-02-14 16:48:44 +0300 |
commit | 993839ce85137ac37a978f49ae894703a39dbf6a (patch) | |
tree | f0e4edc59548d029f425f9dff150d170ab2463d6 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | 3a9a37d6dccb0a981b1fad0cda977b4a445341a1 (diff) |
Fix T95177: GPU subdiv crashes mirror modifier in edit-mode
The issue has two causes: on one hand origin indices were not handled
properly, on the other hand the extraction type (Mesh, BMesh, or mapped)
was not detected correctly.
For the second case reuse the MeshRenderData creation from the coarse
code path so that we make the same decisions. Loose geometry extraction
had to be updated to properly handle the BMesh cases.
For the origin indices, in some cases (for edges and faces), the arrays
used by the subdivision code already have the origin indices baked into
them, so mapping them a second time through the origin index layer is
wrong, and could cause out of bounds accesses.
For vertices especially, we would use two arrays: one for mapping
subdivision vertices to coarse vertices, and another one to map coarse
vertices to subdivision loops used for the selection index buffer. The
second one is now removed (which saves a bit of memory) as it is did not
have the proper data setup for use with the origin indices and we can
easily compute it using the first array anyway.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index f57921d058c..db4c95baedb 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2076,7 +2076,20 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, } if (do_subdivision) { - DRW_create_subdivision(scene, ob, me, cache, &cache->final, ts); + DRW_create_subdivision(scene, + ob, + me, + cache, + &cache->final, + is_editmode, + is_paint_mode, + is_mode_active, + ob->obmat, + true, + false, + use_subsurf_fdots, + ts, + use_hide); } else { /* The subsurf modifier may have been recently removed, or another modifier was added after it, |