diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-02 17:22:19 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-03-02 17:22:19 +0300 |
commit | 3a0df7d37bcf55b2b0f9a070d5c80f908e46ebc4 (patch) | |
tree | 01e256d9f853dbed48217c0ce95b8cc2946a3031 /source/blender/draw/intern/draw_cache_extract_mesh.cc | |
parent | 47396ea81edba585cc69c5760703cde727bc08a6 (diff) | |
parent | 6883c47bb5930be5a95d1c2e8e06fce2d3b68681 (diff) |
Merge remote-tracking branch 'origin/blender-v3.1-release'
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.cc')
-rw-r--r-- | source/blender/draw/intern/draw_cache_extract_mesh.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 49e51d77f7b..dea3fa9b75a 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -806,7 +806,27 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, extractors.append(&extract_fdots_pos); } - EXTRACT_ADD_REQUESTED(ibo, lines); + if (DRW_ibo_requested(mbuflist->ibo.lines_loose)) { + /* `ibo.lines_loose` require the `ibo.lines` buffer. */ + if (mbuflist->ibo.lines == nullptr) { + DRW_ibo_request(nullptr, &mbuflist->ibo.lines); + } + const MeshExtract *extractor = DRW_ibo_requested(mbuflist->ibo.lines) ? + &extract_lines_with_lines_loose : + &extract_lines_loose_only; + extractors.append(extractor); + } + else if (DRW_ibo_requested(mbuflist->ibo.lines)) { + const MeshExtract *extractor; + if (mbuflist->ibo.lines_loose != nullptr) { + /* Update `ibo.lines_loose` as it depends on `ibo.lines`. */ + extractor = &extract_lines_with_lines_loose; + } + else { + extractor = &extract_lines; + } + extractors.append(extractor); + } EXTRACT_ADD_REQUESTED(ibo, edituv_points); EXTRACT_ADD_REQUESTED(ibo, edituv_tris); EXTRACT_ADD_REQUESTED(ibo, edituv_lines); @@ -835,6 +855,7 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, mesh_render_data_update_looptris(mr, MR_ITER_LOOPTRI, MR_DATA_LOOPTRI); mesh_render_data_update_loose_geom(mr, mbc, MR_ITER_LEDGE | MR_ITER_LVERT, MR_DATA_LOOSE_GEOM); + DRW_subdivide_loose_geom(subdiv_cache, mbc); void *data_stack = MEM_mallocN(extractors.data_size_total(), __func__); uint32_t data_offset = 0; @@ -868,7 +889,7 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, } if (extractor->iter_loose_geom_subdiv) { - extractor->iter_loose_geom_subdiv(subdiv_cache, mr, &mbc->loose_geom, buffer, data); + extractor->iter_loose_geom_subdiv(subdiv_cache, mr, buffer, data); } if (extractor->finish_subdiv) { |