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.
This commit is contained in:
Lukas Stockner 2016-10-21 02:49:00 +02:00
parent 0c4d949eff
commit f7ce482385
Notes: blender-bot 2023-02-14 07:29:13 +01:00
Referenced by issue #49813, Crash after changing Alembic cache topology
2 changed files with 9 additions and 13 deletions

View File

@ -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

View File

@ -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)