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:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/draw/intern/draw_manager_data.c5
-rw-r--r--source/blender/gpu/GPU_buffers.h2
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c21
3 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 5a92058001f..94a3e9e8343 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -884,6 +884,11 @@ static float sculpt_debug_colors[9][4] = {
static void sculpt_draw_cb(DRWSculptCallbackData *scd, GPU_PBVH_Buffers *buffers)
{
+
+ if (scd->use_mask && !GPU_pbvh_buffers_has_overlays(buffers)) {
+ return;
+ }
+
GPUBatch *geom = GPU_pbvh_buffers_batch_get(buffers, scd->fast_mode, scd->use_wire);
short index = 0;
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 9d17b199722..9d91fd79137 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -113,7 +113,7 @@ struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast
short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers);
-bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers);
+bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers);
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index c377d196eb5..3dc5052d472 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -92,7 +92,7 @@ struct GPU_PBVH_Buffers {
* smooth-shaded or all faces are flat-shaded */
bool smooth;
- bool show_mask;
+ bool show_overlay;
};
static struct {
@@ -224,6 +224,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
const bool show_face_sets = sculpt_face_sets &&
(update_flags & GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS) != 0;
bool empty_mask = true;
+ bool default_face_set = true;
{
int totelem = (buffers->smooth ? totvert : (buffers->tot_tri * 3));
@@ -275,6 +276,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
/* Skip for the default color Face Set to render it white. */
if (fset != face_sets_color_default) {
face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color);
+ default_face_set = false;
}
}
for (int j = 0; j < 3; j++) {
@@ -336,6 +338,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
/* Skip for the default color Face Set to render it white. */
if (fset != face_sets_color_default) {
face_set_overlay_color_get(fset, face_sets_color_seed, face_set_color);
+ default_face_set = false;
}
}
@@ -377,7 +380,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers,
const MPoly *mp = &buffers->mpoly[lt->poly];
buffers->material_index = mp->mat_nr;
- buffers->show_mask = !empty_mask;
+ buffers->show_overlay = !empty_mask || !default_face_set;
buffers->mvert = mvert;
}
@@ -410,7 +413,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3],
/* smooth or flat for all */
buffers->smooth = mpoly[looptri[face_indices[0]].poly].flag & ME_SMOOTH;
- buffers->show_mask = false;
+ buffers->show_overlay = false;
/* Count the number of visible triangles */
for (i = 0, tottri = 0; i < face_indices_len; i++) {
@@ -820,7 +823,7 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
buffers->totgrid = totgrid;
buffers->grid_flag_mats = grid_flag_mats;
buffers->gridkey = *key;
- buffers->show_mask = !empty_mask;
+ buffers->show_overlay = !empty_mask;
}
/* Threaded - do not call any functions that use OpenGL calls! */
@@ -832,7 +835,7 @@ GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, BLI_bitmap **grid_hid
buffers->grid_hidden = grid_hidden;
buffers->totgrid = totgrid;
- buffers->show_mask = false;
+ buffers->show_overlay = false;
return buffers;
}
@@ -1095,7 +1098,7 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
/* Get material index from the last face we iterated on. */
buffers->material_index = (f) ? f->mat_nr : 0;
- buffers->show_mask = !empty_mask;
+ buffers->show_overlay = !empty_mask;
gpu_pbvh_batch_init(buffers, GPU_PRIM_TRIS);
}
@@ -1114,7 +1117,7 @@ GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading)
buffers = MEM_callocN(sizeof(GPU_PBVH_Buffers), "GPU_Buffers");
buffers->use_bmesh = true;
buffers->smooth = smooth_shading;
- buffers->show_mask = true;
+ buffers->show_overlay = true;
return buffers;
}
@@ -1129,9 +1132,9 @@ GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool
}
}
-bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers)
+bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers)
{
- return buffers->show_mask;
+ return buffers->show_overlay;
}
short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers)