[Bf-blender-cvs] [a48b372] master: Fix T41222 Blender gives weird output when baking (4096*4096) resolution on GPU

Dalai Felinto noreply at git.blender.org
Tue Aug 5 18:51:03 CEST 2014


Commit: a48b372b04421b00644a0660bfdf42229b5ffceb
Author: Dalai Felinto
Date:   Tue Aug 5 13:50:50 2014 -0300
Branches: master
https://developer.blender.org/rBa48b372b04421b00644a0660bfdf42229b5ffceb

Fix T41222 Blender gives weird output when baking (4096*4096) resolution on GPU

In collaboration with Sergey Sharybin.

Also thanks to Wolfgang Faehnle (mib2berlin) for help testing the
solutions.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D690

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

M	intern/cycles/device/device_cuda.cpp
M	intern/cycles/device/device_multi.cpp

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

diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 6629069..d76ffb1 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -25,6 +25,7 @@
 
 #include "cuew.h"
 #include "util_debug.h"
+#include "util_foreach.h"
 #include "util_map.h"
 #include "util_opengl.h"
 #include "util_path.h"
@@ -966,7 +967,10 @@ public:
 
 	int get_split_task_count(DeviceTask& task)
 	{
-		return 1;
+		if (task.type == DeviceTask::SHADER)
+			return task.get_subtask_count(TaskScheduler::num_threads(), 1024 * 1024);
+		else
+			return 1;
 	}
 
 	void task_add(DeviceTask& task)
@@ -979,6 +983,15 @@ public:
 			cuda_assert(cuCtxSynchronize());
 			cuda_pop_context();
 		}
+		else if(task.type == DeviceTask::SHADER) {
+			/* split task into smaller ones */
+			list<DeviceTask> tasks;
+
+			task.split(tasks, TaskScheduler::num_threads(), 1024 * 1024);
+
+			foreach(DeviceTask& task, tasks)
+				task_pool.push(new CUDADeviceTask(this, task));
+		}
 		else {
 			task_pool.push(new CUDADeviceTask(this, task));
 		}
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 564fbdb..7f055c7 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -280,7 +280,18 @@ public:
 
 	int get_split_task_count(DeviceTask& task)
 	{
-		return 1;
+		int total_tasks = 0;
+		list<DeviceTask> tasks;
+		task.split(tasks, devices.size());
+		foreach(SubDevice& sub, devices) {
+			if(!tasks.empty()) {
+				DeviceTask subtask = tasks.front();
+				tasks.pop_front();
+
+				total_tasks += sub.device->get_split_task_count(subtask);
+			}
+		}
+		return total_tasks;
 	}
 
 	void task_add(DeviceTask& task)




More information about the Bf-blender-cvs mailing list