diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-29 11:20:24 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-29 11:20:24 +0300 |
commit | 31ebbe40a08ac48ceb4df4f8d9008c038d9ccd94 (patch) | |
tree | 321bdd5e956e5c362cd3d432ae2426a6a9724a63 /intern/cycles/util/util_path.cpp | |
parent | 94c919349b66ef18f8cc5d3263f73222752cac93 (diff) |
Cycles: Improve OpenCL line information handling
Previously it was falling back to just a path after #include
statement was finished. Now we fall back to a proper current
file name after dealing with the preprocessor statement.
Diffstat (limited to 'intern/cycles/util/util_path.cpp')
-rw-r--r-- | intern/cycles/util/util_path.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp index 9ec67cb0330..62ef8fc0b48 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -778,7 +778,9 @@ static string line_directive(const string& path, int line) } -string path_source_replace_includes(const string& source, const string& path) +string path_source_replace_includes(const string& source, + const string& path, + const string& source_filename) { /* Our own little c preprocessor that replaces #includes with the file * contents, to work around issue of opencl drivers not supporting @@ -807,12 +809,12 @@ string path_source_replace_includes(const string& source, const string& path) * and avoids having list of include directories.x */ text = path_source_replace_includes( - text, path_dirname(filepath)); - text = path_source_replace_includes(text, path); + text, path_dirname(filepath), filename); + text = path_source_replace_includes(text, path, filename); /* Use line directives for better error messages. */ line = line_directive(filepath, 1) + token.replace(0, n_end + 1, "\n" + text + "\n") - + line_directive(path, i); + + line_directive(path_join(path, source_filename), i); } } } |