[Bf-blender-cvs] [31ebbe4] master: Cycles: Improve OpenCL line information handling

Sergey Sharybin noreply at git.blender.org
Thu Sep 29 10:22:03 CEST 2016


Commit: 31ebbe40a08ac48ceb4df4f8d9008c038d9ccd94
Author: Sergey Sharybin
Date:   Thu Sep 29 10:20:24 2016 +0200
Branches: master
https://developer.blender.org/rB31ebbe40a08ac48ceb4df4f8d9008c038d9ccd94

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.

===================================================================

M	intern/cycles/util/util_path.cpp
M	intern/cycles/util/util_path.h

===================================================================

diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index 9ec67cb..62ef8fc 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);
 					}
 				}
 			}
diff --git a/intern/cycles/util/util_path.h b/intern/cycles/util/util_path.h
index 4a89d87..70dbb5a 100644
--- a/intern/cycles/util/util_path.h
+++ b/intern/cycles/util/util_path.h
@@ -66,7 +66,9 @@ bool path_read_text(const string& path, string& text);
 bool path_remove(const string& path);
 
 /* source code utility */
-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="");
 
 /* cache utility */
 void path_cache_clear_except(const string& name, const set<string>& except);




More information about the Bf-blender-cvs mailing list