[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49988] branches/soc-2011-tomato/intern/ cycles/render/light.cpp: Tomato Cycles: fix crash appearing when direct light usage is different on different layers

Sergey Sharybin sergey.vfx at gmail.com
Sat Aug 18 17:46:33 CEST 2012


Revision: 49988
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49988
Author:   nazgul
Date:     2012-08-18 15:46:32 +0000 (Sat, 18 Aug 2012)
Log Message:
-----------
Tomato Cycles: fix crash appearing when direct light usage is different on different layers

Seems some variables used for light sampling should be reset when
integrator's use_direct_light flag is setting to false, otherwise
this values could be used from previously rendered layer resulting
in using freed memory of __light_distribution texture.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/render/light.cpp

Modified: branches/soc-2011-tomato/intern/cycles/render/light.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/light.cpp	2012-08-18 15:20:35 UTC (rev 49987)
+++ branches/soc-2011-tomato/intern/cycles/render/light.cpp	2012-08-18 15:46:32 UTC (rev 49988)
@@ -289,8 +289,14 @@
 		/* CDF */
 		device->tex_alloc("__light_distribution", dscene->light_distribution);
 	}
-	else
+	else {
+		kintegrator->num_distribution = 0;
+		kintegrator->pdf_triangles = 0.0f;
+		kintegrator->pdf_lights = 0.0f;
+		kintegrator->num_all_lights = 0;
+
 		dscene->light_distribution.clear();
+	}
 }
 
 void LightManager::device_update_background(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)




More information about the Bf-blender-cvs mailing list