[Bf-blender-cvs] [8069faa] cycles_kernel_split: Cycles kenrel split : move use_split_kernel to DeviceInfo class

Kavitha Sampath noreply at git.blender.org
Wed May 6 09:54:18 CEST 2015


Commit: 8069faa5a4b8167283ae4c9f9c4b6628e59e2246
Author: Kavitha Sampath
Date:   Tue May 5 18:48:11 2015 +0530
Branches: cycles_kernel_split
https://developer.blender.org/rB8069faa5a4b8167283ae4c9f9c4b6628e59e2246

Cycles kenrel split : move use_split_kernel to DeviceInfo class

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

M	intern/cycles/device/device.h
M	intern/cycles/device/device_multi.cpp
M	intern/cycles/device/device_opencl.cpp
M	intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index af4fa60..3242a3b 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -56,6 +56,7 @@ public:
 	bool advanced_shading;
 	bool pack_images;
 	bool extended_images; /* flag for GPU and Multi device */
+	bool use_split_kernel; /* Denotes if the device is going to run cycles using split-kernel */
 	vector<DeviceInfo> multi_devices;
 
 	DeviceInfo()
@@ -67,6 +68,7 @@ public:
 		advanced_shading = true;
 		pack_images = false;
 		extended_images = false;
+		use_split_kernel = false;
 	}
 };
 
@@ -79,7 +81,7 @@ struct DeviceDrawParams {
 
 class Device {
 protected:
-	Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), info(info_), stats(stats_) { use_split_kernel = false; }
+	Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), info(info_), stats(stats_) {}
 
 	bool background;
 	string error_msg;
@@ -98,8 +100,6 @@ public:
 	/* variables/functions used exclusively for split kernel */
 	/* Maximum closure count */
 	int clos_max;
-	/* Denotes if the device is going to run cycles using split-kernel */
-	bool use_split_kernel;
 	/* Get all closure nodes associated with the scene */
 	set<int> closure_nodes;
 	/* Return background */
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 2cd3e09..e97df87 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -54,14 +54,14 @@ public:
 
 		foreach(DeviceInfo& subinfo, info.multi_devices) {
 			device = Device::create(subinfo, stats, background);
-			atleast_one_split_kernel_dev |= device->use_split_kernel;
+			atleast_one_split_kernel_dev |= device->info.use_split_kernel;
 			devices.push_back(SubDevice(device));
 		}
 
 		/* Set use_split_kernel of multi device to true, even
 		 * if one of the sub devices uses split kernel
 		 */
-		this->use_split_kernel = atleast_one_split_kernel_dev;
+		this->info.use_split_kernel = atleast_one_split_kernel_dev;
 
 #ifdef WITH_NETWORK
 		/* try to add network devices */
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 7513ad6..8be44ca 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1498,7 +1498,7 @@ public:
 		: OpenCLDeviceBase(info, stats, background_)
 	{
 
-		use_split_kernel = true;
+		this->info.use_split_kernel = true;
 		background = background_;
 
 		/* Initialize kernels */
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 7a4c903..6c559a7 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -271,7 +271,7 @@ void Session::run_gpu()
 			/* update status and timing */
 			update_status_time();
 
-			if (device->use_split_kernel) {
+			if (device->info.use_split_kernel) {
 				/* OpenCL split - load kernels */
 				load_kernels();
 			}
@@ -560,7 +560,7 @@ void Session::run_cpu()
 			/* update status and timing */
 			update_status_time();
 
-			if (device->use_split_kernel) {
+			if (device->info.use_split_kernel) {
 				/* OpenCL split - load kernels */
 				load_kernels();
 			}
@@ -613,7 +613,7 @@ void Session::load_kernels()
 {
 	thread_scoped_lock scene_lock(scene->mutex);
 
-	if (!kernels_loaded || (device->use_split_kernel && !device->get_background())) {
+	if (!kernels_loaded || (device->info.use_split_kernel && !device->get_background())) {
 		/* for split kernel, in case if interactive rendering, we
 		 * we need to check kernel-reload before doing path trace
 		 */
@@ -662,7 +662,7 @@ static int getClosureCount(Scene *scene)
 
 void Session::run()
 {
-	if (device->use_split_kernel) {
+	if (device->info.use_split_kernel) {
 		device->clos_max = getClosureCount(scene);
 	}
 
@@ -671,7 +671,7 @@ void Session::run()
 	 * closures that will be used in rendering, which is not known at this point; Hence we
 	 * defer OpenCL split kernel load_kernels() to after device_update
 	 */
-	if (!device->use_split_kernel) {
+	if (!device->info.use_split_kernel) {
 		load_kernels();
 	}
 
@@ -840,7 +840,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
 
 		substatus = string_printf("Path Tracing Tile %d/%d", tile, num_tiles);
 
-		if(((is_gpu && !is_multidevice) || (is_cpu && num_tiles == 1)) && !device->use_split_kernel) {
+		if(((is_gpu && !is_multidevice) || (is_cpu && num_tiles == 1)) && !device->info.use_split_kernel) {
 			/* When using split-kernel (OpenCL) each thread in a tile will be working on a different
 			 * sample. Can't display sample number when device uses split-kernel
 			 */




More information about the Bf-blender-cvs mailing list