[Bf-blender-cvs] [cf59fcd] cycles_kernel_split: Cycles kernel split: Get rid of legacy selective nodes compilation checks

Sergey Sharybin noreply at git.blender.org
Thu May 7 15:53:55 CEST 2015


Commit: cf59fcd34fe640092dafbac35615984e69920612
Author: Sergey Sharybin
Date:   Thu May 7 16:03:09 2015 +0500
Branches: cycles_kernel_split
https://developer.blender.org/rBcf59fcd34fe640092dafbac35615984e69920612

Cycles kernel split: Get rid of legacy selective nodes compilation checks

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

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

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

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 8d422dc..3bd867b 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -103,12 +103,8 @@ public:
 	/* variables/functions used exclusively for split kernel */
 	/* Maximum closure count */
 	int clos_max;
-	/* Get all closure nodes associated with the scene */
-	set<int> closure_nodes;
 	int nodes_max_group;
 	int nodes_features;
-	/* Return background */
-	bool get_background() { return background; }
 
 	/* regular memory */
 	virtual void mem_alloc(device_memory& mem, MemoryType type) = 0;
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index e97df87..c40cd1f 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -102,9 +102,11 @@ public:
 		foreach(SubDevice& sub, devices) {
 
 			/* Update devic's clos_max; used in split kernel */
-			sub.device->clos_max = this->clos_max;
+			/* TODO(sergey): Get rid of this. */
+			sub.device->clos_max = clos_max;
+			sub.device->nodes_max_group = nodes_max_group;
+			sub.device->nodes_features = nodes_features;
 
-			sub.device->closure_nodes = this->closure_nodes;
 			if(!sub.device->load_kernels(experimental))
 				return false;
 		}
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index bec0747..ec271d5 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1777,88 +1777,6 @@ public:
 		return shader_soa_size;
 	}
 
-	/* Get enum type names */
-	/* ToDo: Avoid this switch somehow */
-	string get_node_type_as_string(NodeType node) {
-		switch (node) {
-		case NODE_SHADER_JUMP: return "__NODE_SHADER_JUMP__";
-		case NODE_CLOSURE_BSDF: return "__NODE_CLOSURE_BSDF__";
-		case NODE_CLOSURE_EMISSION: return "__NODE_CLOSURE_EMISSION__";
-		case NODE_CLOSURE_BACKGROUND: return "__NODE_CLOSURE_BACKGROUND__";
-		case NODE_CLOSURE_HOLDOUT: return "__NODE_CLOSURE_HOLDOUT__";
-		case NODE_CLOSURE_AMBIENT_OCCLUSION: return "__NODE_CLOSURE_AMBIENT_OCCLUSION__";
-		case NODE_CLOSURE_VOLUME: return "__NODE_CLOSURE_VOLUME__";
-		case NODE_CLOSURE_SET_WEIGHT: return "__NODE_CLOSURE_SET_WEIGHT__";
-		case NODE_CLOSURE_WEIGHT: return "__NODE_CLOSURE_WEIGHT__";
-		case NODE_EMISSION_WEIGHT: return "__NODE_EMISSION_WEIGHT__";
-		case NODE_MIX_CLOSURE: return "__NODE_MIX_CLOSURE__";
-		case NODE_JUMP_IF_ZERO: return "__NODE_JUMP_IF_ZERO__";
-		case NODE_JUMP_IF_ONE: return "__NODE_JUMP_IF_ONE__";
-		case NODE_TEX_IMAGE: return "__NODE_TEX_IMAGE__";
-		case NODE_TEX_IMAGE_BOX: return "__NODE_TEX_IMAGE_BOX__";
-		case NODE_TEX_ENVIRONMENT: return "__NODE_TEX_ENVIRONMENT__";
-		case NODE_TEX_SKY: return "__NODE_TEX_SKY__";
-		case NODE_TEX_GRADIENT: return "__NODE_TEX_GRADIENT__";
-		case NODE_TEX_NOISE: return "__NODE_TEX_NOISE__";
-		case NODE_TEX_VORONOI: return "__NODE_TEX_VORONOI__";
-		case NODE_TEX_MUSGRAVE: return "__NODE_TEX_MUSGRAVE__";
-		case NODE_TEX_WAVE: return "__NODE_TEX_WAVE__";
-		case NODE_TEX_MAGIC: return "__NODE_TEX_MAGIC__";
-		case NODE_TEX_CHECKER: return "__NODE_TEX_CHECKER__";
-		case NODE_TEX_BRICK: return "__NODE_TEX_BRICK__";
-		case NODE_CAMERA: return "__NODE_CAMERA__";
-		case NODE_GEOMETRY: return "__NODE_GEOMETRY__";
-		case NODE_GEOMETRY_BUMP_DX: return "__NODE_GEOMETRY_BUMP_DX__";
-		case NODE_GEOMETRY_BUMP_DY: return "__NODE_GEOMETRY_BUMP_DY__";
-		case NODE_LIGHT_PATH: return "__NODE_LIGHT_PATH__";
-		case NODE_OBJECT_INFO: return "__NODE_OBJECT_INFO__";
-		case NODE_PARTICLE_INFO: return "__NODE_PARTICLE_INFO__";
-		case NODE_HAIR_INFO: return "__NODE_HAIR_INFO__";
-		case NODE_CONVERT: return "__NODE_CONVERT__";
-		case NODE_VALUE_F: return "__NODE_VALUE_F__";
-		case NODE_VALUE_V: return "__NODE_VALUE_V__";
-		case NODE_INVERT: return "__NODE_INVERT__";
-		case NODE_GAMMA: return "__NODE_GAMMA__";
-		case NODE_BRIGHTCONTRAST: return "__NODE_BRIGHTCONTRAST__";
-		case NODE_MIX: return "__NODE_MIX__";
-		case NODE_SEPARATE_VECTOR: return "__NODE_SEPARATE_VECTOR__";
-		case NODE_COMBINE_VECTOR: return "__NODE_COMBINE_VECTOR__";
-		case NODE_SEPARATE_HSV: return "__NODE_SEPARATE_HSV__";
-		case NODE_COMBINE_HSV: return "__NODE_COMBINE_HSV__";
-		case NODE_HSV: return "__NODE_HSV__";
-		case NODE_ATTR: return "__NODE_ATTR__";
-		case NODE_ATTR_BUMP_DX: return "__NODE_ATTR_BUMP_DX__";
-		case NODE_ATTR_BUMP_DY: return "__NODE_ATTR_BUMP_DY__";
-		case NODE_FRESNEL: return "__NODE_FRESNEL__";
-		case NODE_LAYER_WEIGHT: return "__NODE_LAYER_WEIGHT__";
-		case NODE_WIREFRAME: return "__NODE_WIREFRAME__";
-		case NODE_WAVELENGTH: return "__NODE_WAVELENGTH__";
-		case NODE_BLACKBODY: return "__NODE_BLACKBODY__";
-		case NODE_SET_DISPLACEMENT: return "__NODE_SET_DISPLACEMENT__";
-		case NODE_SET_BUMP: return "__NODE_SET_BUMP__";
-		case NODE_MATH: return "__NODE_MATH__";
-		case NODE_VECTOR_MATH: return "__NODE_VECTOR_MATH__";
-		case NODE_VECTOR_TRANSFORM: return "__NODE_VECTOR_TRANSFORM__";
-		case NODE_NORMAL: return "__NODE_NORMAL__";
-		case NODE_MAPPING: return "__NODE_MAPPING__";
-		case NODE_MIN_MAX: return "__NODE_MIN_MAX__";
-		case NODE_TEX_COORD: return "__NODE_TEX_COORD__";
-		case NODE_TEX_COORD_BUMP_DX: return "__NODE_TEX_COORD_BUMP_DX__";
-		case NODE_TEX_COORD_BUMP_DY: return "__NODE_TEX_COORD_BUMP_DY__";
-		case NODE_CLOSURE_SET_NORMAL: return "__NODE_CLOSURE_SET_NORMAL__";
-		case NODE_RGB_RAMP: return "__NODE_RGB_RAMP__";
-		case NODE_RGB_CURVES: return "__NODE_RGB_CURVES__";
-		case NODE_VECTOR_CURVES: return "__NODE_VECTOR_CURVES__";
-		case NODE_LIGHT_FALLOFF: return "__NODE_LIGHT_FALLOFF__";
-		case NODE_TANGENT: return "__NODE_TANGENT__";
-		case NODE_NORMAL_MAP: return "__NODE_NORMAL_MAP__";
-		case NODE_END: return "__NODE_END__";
-		default:
-			assert(!"Unknown node type passed");
-		}
-		return "";
-	}
-
 	bool load_kernels(bool /*experimental*/)
 	{
 		/* verify if device was initialized */
@@ -1892,13 +1810,6 @@ public:
 		string compute_device_type_build_option = "";
 
 		/* Set svm_build_options */
-		/* Enable only the macros related to the scene */
-		for(int node_iter = NODE_END; node_iter <= NODE_UVMAP; node_iter++) {
-			if(node_iter == NODE_GEOMETRY_DUPLI || node_iter == NODE_UVMAP) { continue; }
-			if(closure_nodes.find(node_iter) != closure_nodes.end()) {
-				svm_build_options += " -D" + get_node_type_as_string((NodeType)node_iter);
-			}
-		}
 		svm_build_options += " -D__NODES_MAX_GROUP__=" + string_printf("%d", nodes_max_group);
 		svm_build_options += " -D__NODES_FEATURES__=" + string_printf("%d", nodes_features);
 		/* Set max closure build option */
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 5dd70b2..16c07e9 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -81,27 +81,6 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
 		compiler.compile(shader, svm_nodes, i);
 	}
 
-	if (!device->get_background()) {
-		/* In case of interactive render, we skip selective compilation of svm nodes optimization */
-		/* Check if NODE_END is indeed the start of NodeType enum */
-		assert(NODE_END == 0);
-		for (int node_type_iter = NODE_END; node_type_iter <= NODE_UVMAP; node_type_iter++) {
-			device->closure_nodes.insert(node_type_iter);
-		}
-	}
-	else {
-		/* Populate set of closure nodes associated with the scene */
-		/* Check if NODE_END is indeed the start of NodeType enum */
-		assert(NODE_END == 0);
-		for(int node_iter = 0; node_iter < svm_nodes.size(); node_iter++) {
-			int4 node = svm_nodes[node_iter];
-			if (node.x >= NODE_END && node.x <= NODE_UVMAP) {
-				/* if node.x is within start and end of NodeType insert node type into device->associated_closure_nodes */
-				device->closure_nodes.insert(node.x);
-			}
-		}
-	}
-
 	/* TODO(sergey): Move this outside of device_update(). */
 	int max_group = NODE_GROUP_LEVEL_0;
 	int features = 0;




More information about the Bf-blender-cvs mailing list