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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-06-28 16:59:40 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-06-28 17:48:32 +0300
commit8de878e202514efbbaeaff7a0693e4899e150bed (patch)
tree7817d071f2d8a005749efad7baf77eaff8290c92 /source/blender/draw/intern/draw_cache_extract_mesh.cc
parent413bd71aaf5e06ccf9555643ed66d335363c4670 (diff)
Draw: make 'ibo.lines_loose' extracting safer
No functional changes.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_extract_mesh.cc')
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc
index d7d43ffe1a3..344150014ed 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc
@@ -649,10 +649,20 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
EXTRACT_ADD_REQUESTED(vbo, skin_roots);
EXTRACT_ADD_REQUESTED(ibo, tris);
- if (DRW_ibo_requested(mbc->ibo.lines)) {
+ if (DRW_ibo_requested(mbc->ibo.lines_loose)) {
+ /* `ibo.lines_loose` require the `ibo.lines` buffer. */
+ if (mbc->ibo.lines == nullptr) {
+ DRW_ibo_request(nullptr, &mbc->ibo.lines);
+ }
+ const MeshExtract *extractor = DRW_ibo_requested(mbc->ibo.lines) ?
+ &extract_lines_with_lines_loose :
+ &extract_lines_loose_only;
+ extractors.append(extractor);
+ }
+ else if (DRW_ibo_requested(mbc->ibo.lines)) {
const MeshExtract *extractor;
if (mbc->ibo.lines_loose != nullptr) {
- /* Update #lines_loose ibo. */
+ /* Update `ibo.lines_loose` as it depends on `ibo.lines`. */
extractor = &extract_lines_with_lines_loose;
}
else {
@@ -660,11 +670,6 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph,
}
extractors.append(extractor);
}
- else if (DRW_ibo_requested(mbc->ibo.lines_loose)) {
- /* Note: #ibo.lines must have been created first. */
- const MeshExtract *extractor = &extract_lines_loose_only;
- extractors.append(extractor);
- }
EXTRACT_ADD_REQUESTED(ibo, points);
EXTRACT_ADD_REQUESTED(ibo, fdots);
EXTRACT_ADD_REQUESTED(ibo, lines_paint_mask);