[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48753] branches/soc-2011-tomato/source/ blender/blenkernel/intern/mask.c: Tomato: fix for mask cache
Sergey Sharybin
sergey.vfx at gmail.com
Mon Jul 9 13:45:07 CEST 2012
Revision: 48753
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48753
Author: nazgul
Date: 2012-07-09 11:45:07 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
Tomato: fix for mask cache
That used to be a threading issue when two different operations
were allowed to access the same mask's cache. Now use lock in
BKE_mask_rasterize_layers so that should work fine now.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c 2012-07-09 11:13:40 UTC (rev 48752)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c 2012-07-09 11:45:07 UTC (rev 48753)
@@ -59,6 +59,9 @@
#include "raskter.h"
#ifdef USE_MANGO_MASK_CACHE_HACK
+
+#include "BLI_threads.h"
+
typedef struct MaskRasterCache {
float *buffer;
int width, height;
@@ -2321,6 +2324,8 @@
float *buffer_tmp;
#ifdef USE_MANGO_MASK_CACHE_HACK
+ BLI_lock_thread(LOCK_CUSTOM1);
+
if (cache &&
cache->width == width &&
cache->height == height &&
@@ -2330,10 +2335,13 @@
mask_layers_compare(&cache->layers, &mask->masklayers))
{
memcpy(buffer, cache->buffer, sizeof(float) * buffer_size);
+
+ BLI_unlock_thread(LOCK_CUSTOM1);
+
return;
}
- BKE_mask_raster_cache_free(mask);
+ BLI_unlock_thread(LOCK_CUSTOM1);
#endif
buffer_tmp = MEM_mallocN(sizeof(float) * buffer_size, __func__);
@@ -2462,6 +2470,10 @@
MEM_freeN(buffer_tmp);
#ifdef USE_MANGO_MASK_CACHE_HACK
+ BLI_lock_thread(LOCK_CUSTOM1);
+
+ BKE_mask_raster_cache_free(mask);
+
cache = MEM_callocN(sizeof(MaskRasterCache), "mask raster cache");
cache->buffer = MEM_mallocN(sizeof(float) * buffer_size, "mask raster cache buffer");
@@ -2477,6 +2489,8 @@
cache->do_feather = do_feather;
mask->raster_cache = cache;
+
+ BLI_unlock_thread(LOCK_CUSTOM1);
#endif
}
More information about the Bf-blender-cvs
mailing list