Blender Git Commit Log

Git Commits -> Revision 68d1348

Revision 68d1348 by Bastien Montagne (master)
June 2, 2016, 14:14 (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: 68d1348ca2f4ae7fcd6eff5b7bdbd84d75988ae8
Parent Commit: ac8246c
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