[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49139] branches/soc-2011-tomato/intern/ cycles: Tomato Cycles: rendering can be cencelled before tile is fully rendered

Sergey Sharybin sergey.vfx at gmail.com
Mon Jul 23 15:01:30 CEST 2012


Revision: 49139
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49139
Author:   nazgul
Date:     2012-07-23 13:01:30 +0000 (Mon, 23 Jul 2012)
Log Message:
-----------
Tomato Cycles: rendering can be cencelled before tile is fully rendered

Probably there;s a proper way to check whether rendering was requested
to cancel, but couldn't see any clearer ways to do that.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/device/device_cpu.cpp
    branches/soc-2011-tomato/intern/cycles/device/device_task.h
    branches/soc-2011-tomato/intern/cycles/render/session.cpp

Modified: branches/soc-2011-tomato/intern/cycles/device/device_cpu.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/device/device_cpu.cpp	2012-07-23 12:27:26 UTC (rev 49138)
+++ branches/soc-2011-tomato/intern/cycles/device/device_cpu.cpp	2012-07-23 13:01:30 UTC (rev 49139)
@@ -155,9 +155,14 @@
 			if(system_cpu_support_optimized()) {
 				for(int y = tile.y; y < tile.y + tile.h; y++) {
 					for(int x = tile.x; x < tile.x + tile.w; x++)
-						for(int sample = start_sample; sample < end_sample; sample++)
+						for(int sample = start_sample; sample < end_sample; sample++) {
+							if (task.get_cancel()) {
+								break;
+							}
+
 							kernel_cpu_optimized_path_trace(kg, render_buffer, rng_state,
 								sample, x, y, tile.offset, tile.stride);
+						}
 
 					if(task_pool.cancelled())
 						break;
@@ -168,10 +173,16 @@
 			{
 				for(int y = tile.y; y < tile.y + tile.h; y++) {
 					for(int x = tile.x; x < tile.x + tile.w; x++)
-						for(int sample = start_sample; sample < end_sample; sample++)
+						for(int sample = start_sample; sample < end_sample; sample++) {
+							if (task.get_cancel()) {
+								break;
+							}
+
 							kernel_cpu_path_trace(kg, render_buffer, rng_state,
 								sample, x, y, tile.offset, tile.stride);
 
+						}
+
 					if(task_pool.cancelled())
 						break;
 				}

Modified: branches/soc-2011-tomato/intern/cycles/device/device_task.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/device/device_task.h	2012-07-23 12:27:26 UTC (rev 49138)
+++ branches/soc-2011-tomato/intern/cycles/device/device_task.h	2012-07-23 13:01:30 UTC (rev 49139)
@@ -59,6 +59,7 @@
 
 	boost::function<bool(Device *device, RenderTile&)> acquire_tile;
 	boost::function<void(RenderTile&)> release_tile;
+	boost::function<bool(void)> get_cancel;
 };
 
 CCL_NAMESPACE_END

Modified: branches/soc-2011-tomato/intern/cycles/render/session.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/session.cpp	2012-07-23 12:27:26 UTC (rev 49138)
+++ branches/soc-2011-tomato/intern/cycles/render/session.cpp	2012-07-23 13:01:30 UTC (rev 49139)
@@ -678,6 +678,7 @@
 	
 	task.acquire_tile = function_bind(&Session::acquire_tile, this, _1, _2);
 	task.release_tile = function_bind(&Session::release_tile, this, _1);
+	task.get_cancel = function_bind(&Progress::get_cancel, &this->progress);
 
 	device->task_add(task);
 }




More information about the Bf-blender-cvs mailing list