diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-06-14 02:38:57 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-06-14 02:39:28 +0300 |
commit | 67f5596f194c0a2aa28780cc3d3c7fa6d99ba6df (patch) | |
tree | 9c2059688e67a001140c9d11fe396116506ff244 /source/blender/draw/intern | |
parent | 77b34a00f96ed0dd5accf3d1350f05332b443019 (diff) |
Fix T98866: GPU subdiv crash in edit mode with loose geometry
The BMesh case was missing when extracting the loose edges flags used for
display, so the code was crashing on unitialized `MEdge` pointer.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc index 7d584824045..4e89b34c0a0 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc @@ -183,10 +183,18 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, uint *flags_data = static_cast<uint *>(GPU_vertbuf_get_data(flags)); - const MEdge *medge = mr->medge; - - for (DRWSubdivLooseEdge edge : loose_edges) { - *flags_data++ = (medge[edge.coarse_edge_index].flag & ME_HIDE) != 0; + if (mr->extract_type == MR_EXTRACT_MESH) { + const MEdge *medge = mr->medge; + for (DRWSubdivLooseEdge edge : loose_edges) { + *flags_data++ = (medge[edge.coarse_edge_index].flag & ME_HIDE) != 0; + } + } + else { + BMesh *bm = mr->bm; + for (DRWSubdivLooseEdge edge : loose_edges) { + const BMEdge *bm_edge = BM_edge_at_index(bm, edge.coarse_edge_index); + *flags_data++ = BM_elem_flag_test_bool(bm_edge, BM_ELEM_HIDDEN) != 0; + } } GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buffer); |