Cycles: Make branched path tracer covered with requested features

This gives few percent extra memory saving for the CUDA kernel when
using regular path tracing.

Still more like an experiment, but will be handy in the future.
This commit is contained in:
Sergey Sharybin 2015-11-22 13:54:51 +05:00
parent 5c5df9dc18
commit 56ead9d34b
3 changed files with 13 additions and 1 deletions

@ -103,6 +103,9 @@ public:
/* Use subsurface scattering materials. */
bool use_subsurface;
/* Use branched integrator. */
bool use_integrator_branched;
DeviceRequestedFeatures()
{
/* TODO(sergey): Find more meaningful defaults. */
@ -115,6 +118,7 @@ public:
use_camera_motion = false;
use_baking = false;
use_subsurface = false;
use_integrator_branched = false;
}
bool modified(const DeviceRequestedFeatures& requested_features)
@ -127,7 +131,8 @@ public:
use_object_motion == requested_features.use_object_motion &&
use_camera_motion == requested_features.use_camera_motion &&
use_baking == requested_features.use_baking &&
use_subsurface == requested_features.use_subsurface);
use_subsurface == requested_features.use_subsurface &&
use_integrator_branched == requested_features.use_integrator_branched);
}
/* Convert the requested features structure to a build options,
@ -159,6 +164,9 @@ public:
if(!use_subsurface) {
build_options += " -D__NO_SUBSURFACE__";
}
if(!use_integrator_branched) {
build_options += " -D__NO_BRANCHED_PATH__";
}
return build_options;
}
};

@ -193,6 +193,9 @@ CCL_NAMESPACE_BEGIN
#ifdef __NO_SUBSURFACE__
# undef __SUBSURFACE__
#endif
#ifdef __NO_BRANCHED_PATH__
# undef __BRANCHED_PATH__
#endif
/* Random Numbers */

@ -639,6 +639,7 @@ DeviceRequestedFeatures Session::get_requested_device_features()
BakeManager *bake_manager = scene->bake_manager;
requested_features.use_baking = bake_manager->get_baking();
requested_features.use_integrator_branched = (scene->integrator->method == Integrator::BRANCHED_PATH);
return requested_features;
}