Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-03-12 15:58:39 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-03-12 16:06:45 +0300
commit298dabc79b9aa335cf7f3e0aa7f7f0fd702c8efd (patch)
tree4bf293669065915494954c226b3bb4e8dd98b1e3 /intern/cycles/device
parent2c8bd1d8cb6dc0f1a182d77c6b8283b25a01f1eb (diff)
Cycles/OpenCL: Reduce How Often Kernel Recompilations Are Needed
This patch will reduce the number of times that we need to recompile kernels. It does this by (en/dis)abling features by default. So when the user needs them that the kernels are already available. Other features are enabled by default for background and foreground rendering. When in background rendering the user wants the best render performance. When in foreground rendering the user wants the least amount of recompilations. Enabling volumetrics or subdivision evaluation will still trigger a recompilation during foreground rendering. Reviewed By: #cycles, brecht Differential Revision: https://developer.blender.org/D4485
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/opencl/opencl.h2
-rw-r--r--intern/cycles/device/opencl/opencl_split.cpp44
2 files changed, 40 insertions, 6 deletions
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index 4ecf71e116e..2a4e07419ac 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -374,6 +374,8 @@ public:
/* Get the program file name to compile (*.cl) for the given kernel */
const string get_opencl_program_filename(const string& kernel_name);
string get_build_options(const DeviceRequestedFeatures& requested_features, const string& opencl_program_name);
+ /* Enable the default features to reduce recompilation events */
+ void enable_default_features(DeviceRequestedFeatures& features);
void mem_alloc(device_memory& mem);
void mem_copy_to(device_memory& mem);
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index b575b008fe0..422813c2e07 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -73,6 +73,25 @@ const string OpenCLDevice::get_opencl_program_filename(const string& kernel_name
}
}
+/* Enable features that we always want to compile to reduce recompilation events */
+void OpenCLDevice::enable_default_features(DeviceRequestedFeatures& features)
+{
+ features.use_transparent = true;
+ features.use_shadow_tricks = true;
+ features.use_principled = true;
+ features.use_denoising = true;
+
+ if (!background)
+ {
+ features.max_nodes_group = NODE_GROUP_LEVEL_MAX;
+ features.nodes_features = NODE_FEATURE_ALL;
+ features.use_hair = true;
+ features.use_subsurface = true;
+ features.use_camera_motion = false;
+ features.use_object_motion = false;
+ }
+}
+
string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_features, const string& opencl_program_name)
{
/* first check for non-split kernel programs */
@@ -84,15 +103,22 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
* displace and background are always requested.
* `__SPLIT_KERNEL__` must not be present in the compile directives for bake */
DeviceRequestedFeatures features(requested_features);
+ enable_default_features(features);
features.use_denoising = false;
features.use_object_motion = false;
features.use_camera_motion = false;
+ features.use_hair = true;
+ features.use_subsurface = true;
+ features.max_nodes_group = NODE_GROUP_LEVEL_MAX;
+ features.nodes_features = NODE_FEATURE_ALL;
+ features.use_integrator_branched = false;
return features.get_build_options();
}
else if (opencl_program_name == "displace") {
/* As displacement does not use any nodes from the Shading group (eg BSDF).
* We disable all features that are related to shading. */
DeviceRequestedFeatures features(requested_features);
+ enable_default_features(features);
features.use_denoising = false;
features.use_object_motion = false;
features.use_camera_motion = false;
@@ -104,13 +130,17 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
features.nodes_features &= ~NODE_FEATURE_VOLUME;
features.use_denoising = false;
features.use_principled = false;
+ features.use_integrator_branched = false;
return features.get_build_options();
}
else if (opencl_program_name == "background") {
/* Background uses Background shading
* It is save to disable shadow features, subsurface and volumetric. */
DeviceRequestedFeatures features(requested_features);
+ enable_default_features(features);
features.use_baking = false;
+ features.use_object_motion = false;
+ features.use_camera_motion = false;
features.use_transparent = false;
features.use_shadow_tricks = false;
features.use_denoising = false;
@@ -120,11 +150,13 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
features.nodes_features &= ~NODE_FEATURE_VOLUME;
features.use_subsurface = false;
features.use_volume = false;
+ features.use_shader_raytrace = false;
+ features.use_patch_evaluation = false;
+ features.use_integrator_branched = false;
return features.get_build_options();
}
string build_options = "-D__SPLIT_KERNEL__ ";
- DeviceRequestedFeatures nofeatures;
/* Set compute device build option. */
cl_device_type device_type;
OpenCLInfo::get_device_type(this->cdDevice, &device_type, &this->ciErr);
@@ -133,17 +165,16 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
build_options += "-D__COMPUTE_DEVICE_GPU__ ";
}
+ DeviceRequestedFeatures nofeatures;
+ enable_default_features(nofeatures);
+
/* Add program specific optimized compile directives */
if (opencl_program_name == "split_do_volume" && !requested_features.use_volume) {
build_options += nofeatures.get_build_options();
}
- else if (opencl_program_name == "split_subsurface_scatter" && !requested_features.use_subsurface) {
- /* When subsurface is off, the kernel updates indexes and does not need any
- * Compile directives */
- build_options += nofeatures.get_build_options();
- }
else {
DeviceRequestedFeatures features(requested_features);
+ enable_default_features(features);
/* Always turn off baking at this point. Baking is only usefull when building the bake kernel.
* this also makes sure that the kernels that are build during baking can be reused
@@ -155,6 +186,7 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_
if (opencl_program_name == "split_bundle") {
features.max_nodes_group = 0;
features.nodes_features = 0;
+ features.use_shader_raytrace = false;
}
/* No specific settings, just add the regular ones */