Cycles: More fixes after include changes
authorMai Lavelle <mai.lavelle@gmail.com>
Fri, 31 Mar 2017 08:12:13 +0000 (10:12 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 31 Mar 2017 08:12:13 +0000 (10:12 +0200)
intern/cycles/device/device_cuda.cpp
intern/cycles/device/opencl/opencl_util.cpp
intern/cycles/util/util_path.cpp

index ba3ca3c3e1e553e5c08879d77fc177ae6f287af5..606494f08eda0deb43edad6c360ffc7bf304e0d4 100644 (file)
@@ -300,8 +300,8 @@ public:
        {
                const int cuda_version = cuewCompilerVersion();
                const int machine = system_cpu_bits();
-               const string kernel_path = path_get("source/kernel");
-               const string include = path_dirname(kernel_path);
+               const string source_path = path_get("source");
+               const string include_path = source_path;
                string cflags = string_printf("-m%d "
                                              "--ptxas-options=\"-v\" "
                                              "--use_fast_math "
@@ -310,7 +310,7 @@ public:
                                               "-I\"%s\"",
                                              machine,
                                              cuda_version,
-                                             include.c_str());
+                                             include_path.c_str());
                if(use_adaptive_compilation()) {
                        cflags += " " + requested_features.get_build_options();
                }
@@ -382,8 +382,8 @@ public:
                        compile_kernel_get_common_cflags(requested_features, split);
 
                /* Try to use locally compiled kernel. */
-               const string kernel_path = path_get("source/kernel");
-               const string kernel_md5 = path_files_md5_hash(kernel_path);
+               const string source_path = path_get("source");
+               const string kernel_md5 = path_files_md5_hash(source_path);
 
                /* We include cflags into md5 so changing cuda toolkit or changing other
                 * compiler command line arguments makes sure cubin gets re-built.
@@ -424,9 +424,10 @@ public:
                        return "";
                }
                const char *nvcc = cuewCompilerPath();
-               const string kernel = path_join(kernel_path,
-                                         path_join("kernels",
-                                                   path_join("cuda", split ? "kernel_split.cu" : "kernel.cu")));
+               const string kernel = path_join(
+                       path_join(source_path, "kernel"),
+                       path_join("kernels",
+                                 path_join("cuda", split ? "kernel_split.cu" : "kernel.cu")));
                double starttime = time_dt();
                printf("Compiling CUDA kernel ...\n");
 
index ed35b6c92b7947fe7f368569adc0c7cf0956d57f..8128fcee09b8465ad83ede3a6de9d3f0960cc89f 100644 (file)
@@ -235,7 +235,7 @@ string OpenCLCache::get_kernel_md5()
        thread_scoped_lock lock(self.kernel_md5_lock);
 
        if(self.kernel_md5.empty()) {
-               self.kernel_md5 = path_files_md5_hash(path_get("source/kernel"));
+               self.kernel_md5 = path_files_md5_hash(path_get("source"));
        }
        return self.kernel_md5;
 }
index 5c00b0551d827933220e413b70f20a3a7d255c3d..cd3067f7650d528c8fb812ec6959813c8663cf1a 100644 (file)
@@ -320,17 +320,18 @@ static char *path_specials(const string& sub)
 {
        static bool env_init = false;
        static char *env_shader_path;
-       static char *env_kernel_path;
+       static char *env_source_path;
        if(!env_init) {
                env_shader_path = getenv("CYCLES_SHADER_PATH");
-               env_kernel_path = getenv("CYCLES_KERNEL_PATH");
+               /* NOTE: It is KERNEL in env variable for compatibility reasons. */
+               env_source_path = getenv("CYCLES_KERNEL_PATH");
                env_init = true;
        }
        if(env_shader_path != NULL && sub == "shader") {
                return env_shader_path;
        }
-       else if(env_shader_path != NULL && sub == "kernel") {
-               return env_kernel_path;
+       else if(env_shader_path != NULL && sub == "source") {
+               return env_source_path;
        }
        return NULL;
 }