[Bf-blender-cvs] [f9a4ae6c30] cycles-tiles-rework: Cycles: Overload DeviceTask::update_progress to take multiple tiles

Mai Lavelle noreply at git.blender.org
Fri Jan 13 02:52:36 CET 2017


Commit: f9a4ae6c308cfd672ae72322a6b4225f0f2bc1bb
Author: Mai Lavelle
Date:   Tue Jan 10 22:00:19 2017 -0500
Branches: cycles-tiles-rework
https://developer.blender.org/rBf9a4ae6c308cfd672ae72322a6b4225f0f2bc1bb

Cycles: Overload DeviceTask::update_progress to take multiple tiles

`update_progress` will only update the tile sample once every second,
which is a problem when there are multiple tiles and calls to this
function. The overload allows for multiple tiles to be updated at once
by getting around the rate limit with a single call.

===================================================================

M	intern/cycles/device/device_task.cpp
M	intern/cycles/device/device_task.h

===================================================================

diff --git a/intern/cycles/device/device_task.cpp b/intern/cycles/device/device_task.cpp
index 48d18035c1..c6f2d242a1 100644
--- a/intern/cycles/device/device_task.cpp
+++ b/intern/cycles/device/device_task.cpp
@@ -22,6 +22,7 @@
 #include "buffers.h"
 
 #include "util_algorithm.h"
+#include "util_foreach.h"
 #include "util_time.h"
 
 CCL_NAMESPACE_BEGIN
@@ -125,5 +126,31 @@ void DeviceTask::update_progress(RenderTile *rtile, int pixel_samples)
 	}
 }
 
+void DeviceTask::update_progress(vector<RenderTile>& rtiles, int pixel_samples)
+{
+	if((type != PATH_TRACE) &&
+	   (type != SHADER))
+		return;
+
+	if(update_progress_sample) {
+		if(pixel_samples == -1) {
+			pixel_samples = shader_w;
+		}
+		update_progress_sample(pixel_samples, rtiles[0].sample);
+	}
+
+	if(update_tile_sample) {
+		double current_time = time_dt();
+
+		if(current_time - last_update_time >= 1.0) {
+			foreach(RenderTile& rtile, rtiles) {
+				update_tile_sample(rtile);
+			}
+
+			last_update_time = current_time;
+		}
+	}
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/device/device_task.h b/intern/cycles/device/device_task.h
index be79a673ee..7d4ef2e653 100644
--- a/intern/cycles/device/device_task.h
+++ b/intern/cycles/device/device_task.h
@@ -62,6 +62,7 @@ public:
 	void split(list<DeviceTask>& tasks, int num, int max_size = 0);
 
 	void update_progress(RenderTile *rtile, int pixel_samples = -1);
+	void update_progress(vector<RenderTile>& rtiles, int pixel_samples = -1);
 
 	function<bool(Device *device, RenderTile&)> acquire_tile;
 	function<bool(Device *device, vector<RenderTile>&, const RenderWorkRequest&)> acquire_tiles;




More information about the Bf-blender-cvs mailing list