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:
authorJoseph Eagar <joeedh@gmail.com>2022-10-15 10:55:45 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-10-15 10:55:45 +0300
commit78b008d20d64bc564cd25564586781535d821925 (patch)
tree0489acbfb660f7881e77a37e269abd69dbbf454a
parentaa1f2f243ddb7ed340856ddf97ec650407ad386b (diff)
temp-pbvh-split: Fix various crashes and memory corruptiontemp-pbvh-split
-rw-r--r--source/blender/blenkernel/intern/pbvh.c15
-rw-r--r--source/blender/blenkernel/intern/pbvh_pixels.cc6
-rw-r--r--source/blender/draw/intern/draw_shader_shared.h2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c6
4 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 2b989885ebc..b012cb7c098 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -3069,9 +3069,24 @@ void BKE_pbvh_draw_debug_cb(PBVH *pbvh,
PBVHNodeFlags flag),
void *user_data)
{
+ PBVHNodeFlags flag = PBVH_Leaf;
+
for (int a = 0; a < pbvh->totnode; a++) {
PBVHNode *node = &pbvh->nodes[a];
+ if (node->flag & PBVH_TexLeaf) {
+ flag = PBVH_TexLeaf;
+ break;
+ }
+ }
+
+ for (int a = 0; a < pbvh->totnode; a++) {
+ PBVHNode *node = &pbvh->nodes[a];
+
+ if (!(node->flag & flag)) {
+ continue;
+ }
+
draw_fn(node, user_data, node->vb.bmin, node->vb.bmax, node->flag);
}
}
diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc
index cbbd25d3f4b..a0c796168ed 100644
--- a/source/blender/blenkernel/intern/pbvh_pixels.cc
+++ b/source/blender/blenkernel/intern/pbvh_pixels.cc
@@ -243,6 +243,8 @@ static void split_pixel_node(PBVH *pbvh,
BKE_image_release_ibuf(image, image_buffer, nullptr);
}
+ data.undo_regions.clear();
+
if (node->flag & PBVH_Leaf) {
data.clear_data();
}
@@ -250,8 +252,6 @@ static void split_pixel_node(PBVH *pbvh,
pbvh_pixels_free(node);
}
- data.undo_regions.clear();
-
BLI_thread_queue_push(tdata->new_nodes, static_cast<void *>(split1));
BLI_thread_queue_push(tdata->new_nodes, static_cast<void *>(split2));
@@ -481,7 +481,7 @@ static void do_encode_pixels(void *__restrict userdata,
static bool should_pixels_be_updated(PBVHNode *node)
{
- if ((node->flag & PBVH_Leaf) == 0) {
+ if ((node->flag & (PBVH_Leaf|PBVH_TexLeaf)) == 0) {
return false;
}
if (node->children_offset != 0) {
diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h
index 75a7e28fa75..9348f8748e7 100644
--- a/source/blender/draw/intern/draw_shader_shared.h
+++ b/source/blender/draw/intern/draw_shader_shared.h
@@ -292,7 +292,7 @@ struct DRWDebugVert {
BLI_STATIC_ASSERT_ALIGN(DRWDebugVert, 16)
/* Take the header (DrawCommand) into account. */
-#define DRW_DEBUG_DRAW_VERT_MAX (64 * 1024) - 1
+#define DRW_DEBUG_DRAW_VERT_MAX (64 * 8192) - 1
/* The debug draw buffer is laid-out as the following struct.
* But we use plain array in shader code instead because of driver issues. */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 37a630b8065..af6afdd1d6e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3368,6 +3368,7 @@ static void do_brush_action(Sculpt *sd,
const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true :
ss->cache->original;
+ const bool use_pixels = sculpt_needs_pbvh_pixels(paint_mode_settings, brush, ob);
if (sculpt_needs_pbvh_pixels(paint_mode_settings, brush, ob)) {
sculpt_pbvh_update_pixels(paint_mode_settings, ss, ob);
@@ -3404,11 +3405,6 @@ static void do_brush_action(Sculpt *sd,
nodes = sculpt_pbvh_gather_generic(ob, sd, brush, use_original, radius_scale, &totnode);
}
- const bool use_pixels = sculpt_needs_pbvh_pixels(paint_mode_settings, brush, ob);
- if (use_pixels) {
- sculpt_pbvh_update_pixels(paint_mode_settings, ss, ob);
- }
-
/* Draw Face Sets in draw mode makes a single undo push, in alt-smooth mode deforms the
* vertices and uses regular coords undo. */
/* It also assigns the paint_face_set here as it needs to be done regardless of the stroke type