[Bf-blender-cvs] [f7ce482] master: Cycles: Fix another OpenCL logging issue

Lukas Stockner noreply at git.blender.org
Fri Oct 21 02:54:20 CEST 2016


Commit: f7ce482385b760135a36ff778e8c3436cdcf5404
Author: Lukas Stockner
Date:   Fri Oct 21 02:49:00 2016 +0200
Branches: master
https://developer.blender.org/rBf7ce482385b760135a36ff778e8c3436cdcf5404

Cycles: Fix another OpenCL logging issue

Previously an error message would be printed whenever the OpenCL build produced output.
However, some frameworks seem to print extra information even if the build succeeded, so now the actual returned error is checked as well.
When --debug-cycles is activated, the build output will always be printed, otherwise it only gets printed if there was an error.

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

M	intern/cycles/device/opencl/opencl_base.cpp
M	intern/cycles/device/opencl/opencl_util.cpp

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

diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp
index ea65be3..e67ffb1 100644
--- a/intern/cycles/device/opencl/opencl_base.cpp
+++ b/intern/cycles/device/opencl/opencl_base.cpp
@@ -233,6 +233,9 @@ bool OpenCLDeviceBase::load_kernels(const DeviceRequestedFeatures& requested_fea
 #else
 	foreach(OpenCLProgram *program, programs) {
 		program->load();
+		if(!program->is_loaded()) {
+			return false;
+		}
 	}
 #endif
 
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index 86aa805..e425ae8 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -316,6 +316,10 @@ bool OpenCLDeviceBase::OpenCLProgram::build_kernel(const string *debug_src)
 
 	clGetProgramBuildInfo(program, device->cdDevice, CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
 
+	if(ciErr != CL_SUCCESS) {
+		add_error(string("OpenCL build failed with error ") + clewErrorString(ciErr) + ", errors in console.");
+	}
+
 	if(ret_val_size > 1) {
 		vector<char> build_log(ret_val_size + 1);
 		clGetProgramBuildInfo(program, device->cdDevice, CL_PROGRAM_BUILD_LOG, ret_val_size, &build_log[0], NULL);
@@ -323,22 +327,11 @@ bool OpenCLDeviceBase::OpenCLProgram::build_kernel(const string *debug_src)
 		build_log[ret_val_size] = '\0';
 		/* Skip meaningless empty output from the NVidia compiler. */
 		if(!(ret_val_size == 2 && build_log[0] == '\n')) {
-			add_error("OpenCL build failed: errors in console");
-			if(use_stdout) {
-				fprintf(stderr, "OpenCL kernel build output:\n%s\n", &build_log[0]);
-			}
-			else {
-				compile_output = string(&build_log[0]);
-			}
+			add_log(string("OpenCL program ") + program_name + " build output: " + string(&build_log[0]), ciErr == CL_SUCCESS);
 		}
 	}
 
-	if(ciErr != CL_SUCCESS) {
-		add_error(string("OpenCL build failed: ") + clewErrorString(ciErr));
-		return false;
-	}
-
-	return true;
+	return (ciErr == CL_SUCCESS);
 }
 
 bool OpenCLDeviceBase::OpenCLProgram::compile_kernel(const string *debug_src)




More information about the Bf-blender-cvs mailing list