Revision: 18057
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18057
Author:   joeedh
Date:     2008-12-25 20:33:41 +0100 (Thu, 25 Dec 2008)

Log Message:
-----------
fixed infinite loop with threads and classical shadow lamps mixed with dsm lamps

Modified Paths:
--------------
    branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
    branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c
    branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c
    branches/soc-2007-joeedh/source/blender/blenlib/intern/threads.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
    branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c       
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c       
2008-12-25 19:33:41 UTC (rev 18057)
@@ -1,5 +1,5 @@
 /**
- * $Id: cache.c 10648 2007-05-03 21:37:52Z blendix $
+ * $Id: tcs_cache.c 10648 2007-05-03 21:37:52Z joeedh $
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -59,7 +59,7 @@
        pool->maxmem = max_mem_bytes;
        
        /*this is to group cache runs so they process no less then 5 megs at a 
time.*/
-       pool->grace_period = 5*1024*1024; 
+       pool->grace_period = max_mem_bytes > 45*1024*1024 ? 25*1024*1024 : 
5*1024*1024; 
        
        return pool;
 }

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c        
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_file.c        
2008-12-25 19:33:41 UTC (rev 18057)
@@ -1,5 +1,5 @@
 /**
- * $Id: tcs_file.c 10648 2007-05-03 21:37:52Z blendix $
+ * $Id: tcs_file.c 10648 2007-05-03 21:37:52Z joeedh $
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *

Modified: branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c       
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c       
2008-12-25 19:33:41 UTC (rev 18057)
@@ -1,5 +1,5 @@
 /**
- * $Id: tcs_image.c 10648 2007-05-03 21:37:52Z blendix $
+ * $Id: tcs_image.c 10648 2007-05-03 21:37:52Z joeedh $
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *

Modified: branches/soc-2007-joeedh/source/blender/blenlib/intern/threads.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/blenlib/intern/threads.c    
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/blenlib/intern/threads.c    
2008-12-25 19:33:41 UTC (rev 18057)
@@ -37,6 +37,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_threads.h"
+#include "BKE_global.h"
 
 #include "PIL_time.h"
 
@@ -357,6 +358,20 @@
                pthread_mutex_lock(&_custom1_lock);
        else if (type==LOCK_CACHER)
                pthread_mutex_lock(&_tcs_lock);
+    
+    if (G.rt == 144) {
+               char *s = "invalid lock type";
+               switch (type) {
+                       case LOCK_IMAGE:
+                               s = "LOCK_IMAGE"; break;
+                       case LOCK_CUSTOM1:
+                               s = "LOCK_CUSTOM1"; break;
+                       case LOCK_CACHER:
+                               s = "LOCK_CACHER"; break;
+               }
+               printf("locked %s\n", s);
+               fflush(stdout);
+    }
 }
 
 void BLI_unlock_thread(int type)
@@ -367,6 +382,20 @@
                pthread_mutex_unlock(&_custom1_lock);
        else if(type==LOCK_CACHER)
                pthread_mutex_unlock(&_tcs_lock);
+
+    if (G.rt==144) {
+               char *s = "invalid lock type";
+               switch (type) {
+                       case LOCK_IMAGE:
+                               s = "LOCK_IMAGE"; break;
+                       case LOCK_CUSTOM1:
+                               s = "LOCK_CUSTOM1"; break;
+                       case LOCK_CACHER:
+                               s = "LOCK_CACHER"; break;
+               }
+               printf("unlocked %s\n", s);
+               fflush(stdout);
+    }
 }
 
 /* how many threads are native on this system? */

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c  
2008-12-25 19:33:41 UTC (rev 18057)
@@ -357,7 +357,7 @@
        else if (G.rt==72)
                dbuf->max_depth = 256*6*shb->osasamp*shb->osasamp;
        else
-               dbuf->max_depth = 256*6*shb->osasamp*shb->osasamp;
+               dbuf->max_depth = 160*6*shb->osasamp*shb->osasamp;
 
        dbuf->max_layers = 0;
        
@@ -1358,7 +1358,6 @@
        corners[2] = DSM_sampleMap(shb, ceil(xs),  ceil(ys), zs, bias, inp, 
component);
        corners[3] = DSM_sampleMap(shb, floor(xs), ceil(ys), zs, bias, inp, 
component);
        
-       //use linear interpolation, or "mix" formula
        //do linear interpolation on the horizontal edges, then
        //interpolate between the 2 interpolated points.
        a = corners[0] + (corners[3] - corners[0]) * (ys - floor(ys));

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c      
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/shadbuf.c      
2008-12-25 19:33:41 UTC (rev 18057)
@@ -568,7 +568,8 @@
                for(a=0; a<totthread; a++)
                        BLI_insert_thread(&threads, re);
 
-               /* keep rendering as long as there are shadow buffers not ready 
*/
+               /* keep rendering as long as there are non-dsm shadow
+                  buffers not ready */
                do {
                        if((g_break=test_break()))
                                break;
@@ -577,7 +578,7 @@
 
                        BLI_lock_thread(LOCK_CUSTOM1);
                        for(lar=re->lampren.first; lar; lar= lar->next)
-                               if(lar->shb && !lar->thread_ready)
+                               if(lar->shb && lar->buftype != LA_SHADBUF_DEEP 
&& !lar->thread_ready)
                                        break;
                        BLI_unlock_thread(LOCK_CUSTOM1);
                } while(lar);

Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c
===================================================================
--- branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c 
2008-12-25 18:29:56 UTC (rev 18056)
+++ branches/soc-2007-joeedh/source/blender/render/intern/source/zbuf.c 
2008-12-25 19:33:41 UTC (rev 18057)
@@ -1849,11 +1849,11 @@
                                break;
                }
 
-               TCS_EnablePool(bucketbuf->buffer.pool);
-               
                if(re->test_break()) break;
        }
 
+       TCS_EnablePool(bucketbuf->buffer.pool);
+
        re_sort_buckets(bucketbuf);
        return bucketbuf;
 }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to