[Bf-blender-cvs] [b561707bed0] blender2.8: Gawain: Make removing batches more thread safe

Sergey Sharybin noreply at git.blender.org
Wed Apr 4 17:49:18 CEST 2018


Commit: b561707bed0e4a464ffa8f8027fa7869b1544fb4
Author: Sergey Sharybin
Date:   Wed Apr 4 17:24:57 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb561707bed0e4a464ffa8f8027fa7869b1544fb4

Gawain: Make removing batches more thread safe

The issue was mainly visible when copy-on-write was enabled. This was forcing
lots of meshes to be freed from multiple thread, causing all sorts of race
conditions in Gawain's VAO code.

OpenGL resources seems already to be doing deferred deletion, need to do the
same for CPU side arrays.

===================================================================

M	intern/gawain/src/gwn_vertex_array_id.cpp

===================================================================

diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp b/intern/gawain/src/gwn_vertex_array_id.cpp
index ed54562c434..ad60dea7542 100644
--- a/intern/gawain/src/gwn_vertex_array_id.cpp
+++ b/intern/gawain/src/gwn_vertex_array_id.cpp
@@ -166,5 +166,7 @@ void gwn_context_add_batch(Gwn_Context* ctx, Gwn_Batch* batch)
 
 void gwn_context_remove_batch(Gwn_Context* ctx, Gwn_Batch* batch)
 	{
+	ctx->orphans_mutex.lock();
 	ctx->batches.erase(batch);
+	ctx->orphans_mutex.unlock();
 	}



More information about the Bf-blender-cvs mailing list