[Bf-blender-cvs] [8d48ea0233b] master: Cycles: Make shadow catcher an optional feature for OpenCL

Sergey Sharybin noreply at git.blender.org
Mon Mar 27 11:29:06 CEST 2017


Commit: 8d48ea0233b9f0aba9a7a7bf8591e4110008c11c
Author: Sergey Sharybin
Date:   Tue Mar 21 13:55:27 2017 +0100
Branches: master
https://developer.blender.org/rB8d48ea0233b9f0aba9a7a7bf8591e4110008c11c

Cycles: Make shadow catcher an optional feature for OpenCL

Solves majority of speed regression on AMD OpenCL.

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

M	intern/cycles/device/device.h
M	intern/cycles/kernel/kernel_types.h
M	intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index ec15a254f81..468a5b1515a 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -121,6 +121,9 @@ public:
 	/* Use Transparent shadows */
 	bool use_transparent;
 
+	/* Use various shadow tricks, such as shadow catcher. */
+	bool use_shadow_tricks;
+
 	DeviceRequestedFeatures()
 	{
 		/* TODO(sergey): Find more meaningful defaults. */
@@ -137,6 +140,7 @@ public:
 		use_integrator_branched = false;
 		use_patch_evaluation = false;
 		use_transparent = false;
+		use_shadow_tricks = false;
 	}
 
 	bool modified(const DeviceRequestedFeatures& requested_features)
@@ -153,7 +157,8 @@ public:
 		         use_volume == requested_features.use_volume &&
 		         use_integrator_branched == requested_features.use_integrator_branched &&
 		         use_patch_evaluation == requested_features.use_patch_evaluation &&
-		         use_transparent == requested_features.use_transparent);
+		         use_transparent == requested_features.use_transparent &&
+		         use_shadow_tricks == requested_features.use_shadow_tricks);
 	}
 
 	/* Convert the requested features structure to a build options,
@@ -197,6 +202,9 @@ public:
 		if(!use_transparent && !use_volume) {
 			build_options += " -D__NO_TRANSPARENT__";
 		}
+		if(!use_shadow_tricks) {
+			build_options += " -D__NO_SHADOW_TRICKS__";
+		}
 		return build_options;
 	}
 };
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index f028f991148..1ae624e06c5 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -213,6 +213,9 @@ CCL_NAMESPACE_BEGIN
 #ifdef __NO_TRANSPARENT__
 #  undef __TRANSPARENT_SHADOWS__
 #endif
+#ifdef __NO_SHADOW_TRICKS__
+#undef __SHADOW_TRICKS__
+#endif
 
 /* Random Numbers */
 
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index e7050f9ef37..bd664b35e19 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_patch_evaluation = true;
 		}
 #endif
+		if(object->is_shadow_catcher) {
+			requested_features.use_shadow_tricks = true;
+		}
 	}
 
 	BakeManager *bake_manager = scene->bake_manager;




More information about the Bf-blender-cvs mailing list