[Bf-blender-cvs] [d4c676e] master: Cycles: CYCLES_OPRNCL_DEBUG now affects on split kernel as well

Sergey Sharybin noreply at git.blender.org
Thu May 21 11:40:42 CEST 2015


Commit: d4c676e81b7794fa1cb6b26412e2a44b0b7fde36
Author: Sergey Sharybin
Date:   Thu May 21 14:30:33 2015 +0500
Branches: master
https://developer.blender.org/rBd4c676e81b7794fa1cb6b26412e2a44b0b7fde36

Cycles: CYCLES_OPRNCL_DEBUG now affects on split kernel as well

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

M	intern/cycles/device/device_opencl.cpp

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

diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 735abc6..67ed1c7 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -1838,16 +1838,14 @@ public:
 	                       string kernel_init_source,
 	                       string clbin,
 	                       string custom_kernel_build_options,
-	                       cl_program *program)
+	                       cl_program *program,
+	                       const string *debug_src = NULL)
 	{
 		if(!opencl_version_check())
 			return false;
 
 		clbin = path_user_get(path_join("cache", clbin));
 
-		/* Path to preprocessed source for debugging. */
-		string *debug_src = NULL;
-
 		/* If exists already, try use it. */
 		if(path_exists(clbin) && load_binary(kernel_path,
 		                                     clbin,
@@ -1861,7 +1859,8 @@ public:
 			if(!compile_kernel(kernel_path,
 			                   kernel_init_source,
 			                   custom_kernel_build_options,
-			                   program))
+			                   program,
+			                   debug_src))
 			{
 				return false;
 			}
@@ -1967,6 +1966,7 @@ public:
 		string build_options;
 		string kernel_init_source;
 		string clbin;
+		string clsrc, *debug_src = NULL;
 
 		build_options += "-D__SPLIT_KERNEL__";
 #ifdef __WORK_STEALING__
@@ -2001,9 +2001,16 @@ public:
 		device_md5 = device_md5_hash(build_options); \
 		clbin = string_printf("cycles_kernel_%s_%s_" #name ".clbin", \
 		                      device_md5.c_str(), kernel_md5.c_str()); \
+		if(opencl_kernel_use_debug()) { \
+			clsrc = string_printf("cycles_kernel_%s_%s_" #name ".cl", \
+			                      device_md5.c_str(), kernel_md5.c_str()); \
+			clsrc = path_user_get(path_join("cache", clsrc)); \
+			debug_src = &clsrc; \
+		} \
 		if(!load_split_kernel(kernel_path, kernel_init_source, clbin, \
 		                      build_options, \
-		                      &GLUE(name, _program))) \
+		                      &GLUE(name, _program), \
+		                      debug_src)) \
 		{ \
 			fprintf(stderr, "Faled to compile %s\n", #name); \
 			return false; \




More information about the Bf-blender-cvs mailing list