diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-01-05 06:58:27 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-01-05 06:58:27 +0400 |
commit | d9697bc1455dc556fd233aae9d45b523af62669b (patch) | |
tree | bd3bdcf47862f45362c7aef105efa193c586966c /source/blender/blenkernel/intern/pbvh_bmesh.c | |
parent | 0074eac1ed6a876a951f04b6a017fd7058041558 (diff) |
Fix T38024 crash when rebuilding sculpt mode buffers.
Main issue here is that glBuf* calls were invoked from threads different than
main thread. This caused a crash (since those do not have a GL context active).
Fix here is twofold:
* add an ID buffer in buffer pool that handles pbvh buffers and is freed
from main thread when gpu_buffer_pool_free_unused is called.
* do not create glbuffers in derivedmesh creation routine, rather tag nodes
for update and create those in the draw function
(guaranteed to be called from main thread)
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D169
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh_bmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 4bd2114ee79..bfde9a9d774 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -91,12 +91,9 @@ static void pbvh_bmesh_node_finalize(PBVH *bvh, int node_index) n->orig_vb = n->vb; - /* Build GPU buffers */ - if (!G.background) { - int smooth = bvh->flags & PBVH_DYNTOPO_SMOOTH_SHADING; - n->draw_buffers = GPU_build_bmesh_pbvh_buffers(smooth); - n->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals; - } + /* Build GPU buffers for new node and update vertex normals */ + BKE_pbvh_node_mark_rebuild_draw(n); + n->flag |= PBVH_UpdateNormals; } /* Recursively split the node if it exceeds the leaf_limit */ |