diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-21 15:55:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-27 11:47:14 +0300 |
commit | 8d48ea0233b9f0aba9a7a7bf8591e4110008c11c (patch) | |
tree | 06daa07e2a50f7f7dc3b06531a223aee08b11150 | |
parent | e07ffcbd1cd527a21f61b42f92aa3b8296ddd941 (diff) |
Cycles: Make shadow catcher an optional feature for OpenCL
Solves majority of speed regression on AMD OpenCL.
-rw-r--r-- | intern/cycles/device/device.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 3 | ||||
-rw-r--r-- | intern/cycles/render/session.cpp | 3 |
3 files changed, 15 insertions, 1 deletions
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; |