[Bf-blender-cvs] [45b5bf0] master: Cycles; Make baking a feature-specific option

Sergey Sharybin noreply at git.blender.org
Sat Jul 18 16:06:11 CEST 2015


Commit: 45b5bf034b053509d7175e74ddea22c658b4717e
Author: Sergey Sharybin
Date:   Sat Jul 18 15:34:32 2015 +0200
Branches: master
https://developer.blender.org/rB45b5bf034b053509d7175e74ddea22c658b4717e

Cycles; Make baking a feature-specific option

This means render devices now might skip building baking kernels in cases when
only actual render-related functionality is used.

For now it's only implemented for OpenCL split kernel device and mainly needed
to work around some compiler-specific bugs which crashes on building the kernel.

Using OpenCL for baking might still crash the driver, but at least there is now
higher probability of that GPU will be usable to render the scene.

Real fix should actually be done in the driver side.

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

M	intern/cycles/blender/blender_session.cpp
M	intern/cycles/device/device.h
M	intern/cycles/device/device_opencl.cpp
M	intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index cdc4474..7342ed3 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -543,6 +543,11 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
 	size_t object_index = OBJECT_NONE;
 	int tri_offset = 0;
 
+	/* Set baking flag in advance, so kernel loading can check if we need
+	 * any baking capabilities.
+	 */
+	scene->bake_manager->set_baking(true);
+
 	/* ensure kernels are loaded before we do any scene updates */
 	session->load_kernels();
 
@@ -572,7 +577,6 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
 	BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
 
 	scene->bake_manager->set_shader_limit((size_t)b_engine.tile_x(), (size_t)b_engine.tile_y());
-	scene->bake_manager->set_baking(true);
 
 	/* set number of samples */
 	session->tile_manager.set_samples(session_params.samples);
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 6b4a190..7c4f5b6 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -97,6 +97,9 @@ public:
 	bool use_object_motion;
 	bool use_camera_motion;
 
+	/* Denotes whether baking functionality is needed. */
+	bool use_baking;
+
 	DeviceRequestedFeatures()
 	{
 		/* TODO(sergey): Find more meaningful defaults. */
@@ -107,6 +110,7 @@ public:
 		use_hair = false;
 		use_object_motion = false;
 		use_camera_motion = false;
+		use_baking = false;
 	}
 
 	bool modified(const DeviceRequestedFeatures& requested_features)
@@ -114,7 +118,11 @@ public:
 		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);
+		         nodes_features == requested_features.nodes_features &&
+		         use_hair == requested_features.use_hair &&
+		         use_object_motion == requested_features.use_object_motion &&
+		         use_camera_motion == requested_features.use_camera_motion &&
+		         use_baking == requested_features.use_baking);
 	}
 };
 
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 3305ef4..3581026 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1560,6 +1560,9 @@ protected:
 		if(!requested_features.use_camera_motion) {
 			build_options += " -D__NO_CAMERA_MOTION__";
 		}
+		if(!requested_features.use_baking) {
+			build_options += " -D__NO_BAKING__";
+		}
 		return build_options;
 	}
 
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 57c1500..f3acebd 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -637,6 +637,9 @@ DeviceRequestedFeatures Session::get_requested_device_features()
 		requested_features.use_camera_motion |= mesh->use_motion_blur;
 	}
 
+	BakeManager *bake_manager = scene->bake_manager;
+	requested_features.use_baking = bake_manager->get_baking();
+
 	return requested_features;
 }




More information about the Bf-blender-cvs mailing list