Blender Git Commit Log

Git Commits -> Revision 342a5cb

Revision 342a5cb by Bastien Montagne (compositor-2016)
June 8, 2016, 19:45 (GMT)
Fix T47637: Multiple multires objects in Sculpt mode make blender crash.

That was a nice and funny hunt, albeit rather time consumming!

To summarize, so far code was using a static global gpu_buffer for pbvh vbo drawing
of 'grid' types (multires mostly?).

There were two issues here:
1) Global gpu buffer was assigned to GPU_PBVH_Buffers->index_buf, but then nearly no
check was done when freeing that buffer, to ensure we were not freeing the global one
(not totally sure this one was actually causing any issue, but was bad and unsafe anyway).
Was solved by adding a flag to GPU_PBVH_Buffers to indicate when we are using some
'common' buffer here, which freeing is handled separately.

2) Main issue: if several multires objects in sculpt mode with different grid size
were present simultaneously, the global gpu buffer had to be resized for each object draw
(i.e., freed and re-allocated), but then the pbvh nodes from other objects storing freed reference
to that global buffer had no way to know that it had been freed, which was causing the segfault & crash.
Was solved by getting rid of that global buffer, and instead allocating one 'grid_commmon_gpu_buffer' per pbvh.

Told ya baby, globals are *PURE EVIL*!

Commit Details:

Full Hash: 342a5cb8261400735cb5f9098334b785dd4c4da8
Parent Commit: 98bb8d5
Committed By: Jeroen Bakker
Lines Changed: +83, -60

5 Modified Paths:

/source/blender/blenkernel/intern/pbvh.c (+2, -1) (Diff)
/source/blender/blenkernel/intern/pbvh_intern.h (+5, -0) (Diff)
/source/blender/gpu/GPU_buffers.h (+5, -5) (Diff)
/source/blender/gpu/intern/gpu_buffers.c (+71, -53) (Diff)
/source/blender/gpu/intern/gpu_init_exit.c (+0, -1) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021