Make GPU buffers allocation/freeing safe for threading
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 15 Jul 2013 18:46:08 +0000 (18:46 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 15 Jul 2013 18:46:08 +0000 (18:46 +0000)
commit3ede7482af0f77706bb79c471021c00488e5cf10
tree2b482b70e8b6bfdd9ceeeec1f86dd1e3c4b3dd0c
parentd44fb5bd8b8fdb2635ae060ef2a92bb883ff50e0
Make GPU buffers allocation/freeing safe for threading

Code in GPU_buffers_free was already trying to be safe
for threading, by skipping OGL calls there, but in fact
it was still buggy.

Namely, freeing was doing buffers shift in a cycle, and
if two threads will call this function shifting will go
crazy.

Now made it so GPU_buffers_alloc and GPU_buffers_free
are using mutex lock, so they're completely safe for
threading. Same goes to gpu_buffer_setup function.

It required minor functions reshuffle, so there're no
locks happening from locked thread, but it's all very
straightforward change.
source/blender/gpu/intern/gpu_buffers.c