diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-02-21 07:42:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-02-21 07:42:46 +0300 |
commit | f87a399978e81e96a711347b1dee66dbbbd362d5 (patch) | |
tree | 691eba8bae83244d727a50ff1d51cbd5b3a8499c /source | |
parent | 7260e8fe294d77533dc7f41303419b492fc0de98 (diff) |
[#18058] Black dots appear when blender renders with multi-thread and material nodes
Without thread locking the function that allocates new threads, black dots appear in renders.
This wont affect composite nodes,
Ton/Brecht - this is possibly too many lock/unlocks but I timed the render from the bug report and it didn't make a noticeable difference.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 978b47b651f..9a78f8ea02a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1999,19 +1999,23 @@ static bNodeThreadStack *ntreeGetThreadStack(bNodeTree *ntree, int thread) { ListBase *lb= &ntree->threadstack[thread]; bNodeThreadStack *nts; - + + /* for material shading this is called quite a lot (perhaps too much locking unlocking) + * however without locking we get bug #18058 - Campbell */ + BLI_lock_thread(LOCK_CUSTOM1); + for(nts=lb->first; nts; nts=nts->next) { if(!nts->used) { nts->used= 1; + BLI_unlock_thread(LOCK_CUSTOM1); return nts; } } - nts= MEM_callocN(sizeof(bNodeThreadStack), "bNodeThreadStack"); nts->stack= MEM_dupallocN(ntree->stack); nts->used= 1; BLI_addtail(lb, nts); - + BLI_unlock_thread(LOCK_CUSTOM1); return nts; } |