[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19067] trunk/blender/source/blender/ blenkernel/intern/node.c: [#18058] Black dots appear when blender renders with multi-thread and material nodes

Campbell Barton ideasman42 at gmail.com
Sat Feb 21 05:43:12 CET 2009


Revision: 19067
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19067
Author:   campbellbarton
Date:     2009-02-21 05:42:46 +0100 (Sat, 21 Feb 2009)

Log Message:
-----------
[#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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/node.c

Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c	2009-02-21 03:26:03 UTC (rev 19066)
+++ trunk/blender/source/blender/blenkernel/intern/node.c	2009-02-21 04:42:46 UTC (rev 19067)
@@ -1999,19 +1999,23 @@
 {
 	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;
 }
 





More information about the Bf-blender-cvs mailing list