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:
authorMai Lavelle <mai.lavelle@gmail.com>2017-03-03 12:10:17 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2017-03-08 09:31:09 +0300
commit18e50927f7e1ae22585c667e9f313adc8de5c0da (patch)
treecec6b0333ffe17f5e89525517640459ad7a7a08e /intern/cycles/device
parent223f45818ec216a76d89de0efcb3b0292eabf71e (diff)
Cycles: Faster building of split kernel
Simple change to make it so that only kernels that have been modified are rebuilt. Might only be useful during development.
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index c7760e075cb..d5c19bf5386 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -19,6 +19,7 @@
#include "opencl.h"
#include "util_logging.h"
+#include "util_md5.h"
#include "util_path.h"
#include "util_time.h"
@@ -338,12 +339,13 @@ bool OpenCLDeviceBase::OpenCLProgram::build_kernel(const string *debug_src)
bool OpenCLDeviceBase::OpenCLProgram::compile_kernel(const string *debug_src)
{
- string source = "#include \"kernels/opencl/" + kernel_file + "\" // " + OpenCLCache::get_kernel_md5() + "\n";
+ string source = "#include \"kernels/opencl/" + kernel_file + "\"\n";
/* We compile kernels consisting of many files. unfortunately OpenCL
* kernel caches do not seem to recognize changes in included files.
* so we force recompile on changes by adding the md5 hash of all files.
*/
source = path_source_replace_includes(source, path_get("kernel"));
+ source += "\n// " + util_md5_string(source) + "\n";
if(debug_src) {
path_write_text(*debug_src, source);
@@ -440,7 +442,11 @@ void OpenCLDeviceBase::OpenCLProgram::load()
if(!program) {
add_log(string("OpenCL program ") + program_name + " not found in cache.", true);
- string basename = "cycles_kernel_" + program_name + "_" + device_md5 + "_" + OpenCLCache::get_kernel_md5();
+ /* need to create source to get md5 */
+ string source = "#include \"kernels/opencl/" + kernel_file + "\"\n";
+ source = path_source_replace_includes(source, path_get("kernel"));
+
+ string basename = "cycles_kernel_" + program_name + "_" + device_md5 + "_" + util_md5_string(source);
basename = path_cache_get(path_join("kernels", basename));
string clbin = basename + ".clbin";