[Bf-blender-cvs] [f680c1b] master: Cycles: Communicate number of closures and nodes feature set to the device

Sergey Sharybin noreply at git.blender.org
Sat May 9 16:57:47 CEST 2015


Commit: f680c1b54a28a02fb86271bca649da0660542e9a
Author: Sergey Sharybin
Date:   Sat May 9 19:28:00 2015 +0500
Branches: master
https://developer.blender.org/rBf680c1b54a28a02fb86271bca649da0660542e9a

Cycles: Communicate number of closures and nodes feature set to the device

This way device can actually make a decision of how it can optimize the kernel
in order to make it most efficient.

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

M	intern/cycles/device/device.h
M	intern/cycles/device/device_network.cpp
M	intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 9815590..4d40518 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -74,14 +74,37 @@ public:
 	/* Use experimental feature set. */
 	bool experimental;
 
+	/* Maximum number of closures in shader trees. */
+	int max_closure;
+
+	/* Selective nodes compilation. */
+
+	/* Identifier of a node group up to which all the nodes needs to be
+	 * compiled in. Nodes from higher group indices will be ignores.
+	 */
+	int max_nodes_group;
+
+	/* Features bitfield indicating which features from the requested group
+	 * will be compiled in. Nodes which corresponds to features which are not
+	 * in this bitfield will be ignored even if they're in the requested group.
+	 */
+	int nodes_features;
+
 	DeviceRequestedFeatures()
 	{
+		/* TODO(sergey): Find more meaningful defaults. */
 		experimental = false;
+		max_closure = 0;
+		max_nodes_group = 0;
+		nodes_features = 0;
 	}
 
 	bool modified(const DeviceRequestedFeatures& requested_features)
 	{
-		return !(experimental == requested_features.experimental);
+		return !(experimental == requested_features.experimental &&
+		         max_closure == requested_features.max_closure &&
+		         max_nodes_group == requested_features.max_nodes_group &&
+		         nodes_features == requested_features.nodes_features);
 	}
 };
 
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp
index 454f730..ca6d668 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -205,6 +205,9 @@ public:
 
 		RPCSend snd(socket, &error_func, "load_kernels");
 		snd.add(requested_features.experimental);
+		snd.add(requested_features.max_closure);
+		snd.add(requested_features.max_nodes_group);
+		snd.add(requested_features.nodes_features);
 		snd.write();
 
 		bool result;
@@ -609,6 +612,9 @@ protected:
 		else if(rcv.name == "load_kernels") {
 			DeviceRequestedFeatures requested_features;
 			rcv.read(requested_features.experimental);
+			rcv.read(requested_features.max_closure);
+			rcv.read(requested_features.max_nodes_group);
+			rcv.read(requested_features.nodes_features);
 
 			bool result;
 			result = device->load_kernels(requested_features);
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index cfd9743..aacb81f 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -601,6 +601,18 @@ DeviceRequestedFeatures Session::get_requested_device_features()
 {
 	DeviceRequestedFeatures requested_features;
 	requested_features.experimental = params.experimental;
+	if(!params.background) {
+		requested_features.max_closure = 64;
+		requested_features.max_nodes_group = NODE_GROUP_LEVEL_2;
+		requested_features.nodes_features = NODE_FEATURE_ALL;
+	}
+	else {
+		requested_features.max_closure = get_max_closure_count();
+		scene->shader_manager->get_requested_features(
+		        scene,
+		        requested_features.max_nodes_group,
+		        requested_features.nodes_features);
+	}
 	return requested_features;
 }




More information about the Bf-blender-cvs mailing list