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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-06-06 16:33:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-06-08 12:15:40 +0300
commit2ebaa6967675a201637dae26c5c67d1b5f8c3f26 (patch)
treed51733b09026588e7331cd0317c0ef9cb184fa58
parent8c2750bc82533945022fe413844b8868dbdcd5e8 (diff)
Cycles: Move requested feature conversion to an own function
This way it could be used for the shader/baking kernels easily n the future. making those kernels more optimal.
-rw-r--r--intern/cycles/device/device_opencl.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 693bb1956bd..87c08b3e045 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1262,6 +1262,31 @@ protected:
clReleaseProgram(program);
}
}
+
+ string build_options_from_requested_features(
+ const DeviceRequestedFeatures& requested_features)
+ {
+ string build_options = "";
+ if(requested_features.experimental) {
+ build_options += " -D__KERNEL_EXPERIMENTAL__";
+ }
+ build_options += " -D__NODES_MAX_GROUP__=" +
+ string_printf("%d", requested_features.max_nodes_group);
+ build_options += " -D__NODES_FEATURES__=" +
+ string_printf("%d", requested_features.nodes_features);
+ build_options += string_printf(" -D__MAX_CLOSURE__=%d",
+ requested_features.max_closure);
+ if(!requested_features.use_hair) {
+ build_options += " -D__NO_HAIR__";
+ }
+ if(!requested_features.use_object_motion) {
+ build_options += " -D__NO_OBJECT_MOTION__";
+ }
+ if(!requested_features.use_camera_motion) {
+ build_options += " -D__NO_CAMERA_MOTION__";
+ }
+ return build_options;
+ }
};
class OpenCLDeviceMegaKernel : public OpenCLDeviceBase
@@ -1951,37 +1976,15 @@ public:
string kernel_path = path_get("kernel");
string kernel_md5 = path_files_md5_hash(kernel_path);
string device_md5;
- string build_options;
string kernel_init_source;
string clbin;
string clsrc, *debug_src = NULL;
- build_options += "-D__SPLIT_KERNEL__";
+ string build_options = "-D__SPLIT_KERNEL__";
#ifdef __WORK_STEALING__
build_options += " -D__WORK_STEALING__";
#endif
-
- /* TODO(sergey): Make it a separate function to convert requested
- * features to build flags in order to make code a bit cleaner.
- */
- if(requested_features.experimental) {
- build_options += " -D__KERNEL_EXPERIMENTAL__";
- }
- build_options += " -D__NODES_MAX_GROUP__=" +
- string_printf("%d", requested_features.max_nodes_group);
- build_options += " -D__NODES_FEATURES__=" +
- string_printf("%d", requested_features.nodes_features);
- build_options += string_printf(" -D__MAX_CLOSURE__=%d",
- requested_features.max_closure);
- if(!requested_features.use_hair) {
- build_options += " -D__NO_HAIR__";
- }
- if(!requested_features.use_object_motion) {
- build_options += " -D__NO_OBJECT_MOTION__";
- }
- if(!requested_features.use_camera_motion) {
- build_options += " -D__NO_CAMERA_MOTION__";
- }
+ build_options += build_options_from_requested_features(requested_features);
/* Set compute device build option. */
cl_device_type device_type;