OpenCL: Fix error reporting when the build log is too long

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6603 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Orphis 2010-12-18 04:54:16 +00:00
parent d01542ee0a
commit 42e40b46c0
1 changed files with 19 additions and 4 deletions

View File

@ -159,10 +159,25 @@ cl_program CompileProgram(const char *Kernel)
// Build the program executable // Build the program executable
err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL); err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL);
if(err != CL_SUCCESS) { if(err != CL_SUCCESS) {
char *errors[16384] = {0}; HandleCLError(err, "Error: failed to build program");
err = clGetProgramBuildInfo(program, OpenCL::device_id,
CL_PROGRAM_BUILD_LOG, sizeof(*errors), errors, NULL); char *buildlog = NULL;
ERROR_LOG(COMMON, "Error log:\n%s\n", *errors); size_t buildlog_size = 0;
clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildlog_size);
buildlog = new char[buildlog_size + 1];
err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, buildlog_size, buildlog, NULL);
buildlog[buildlog_size] = 0;
if(err != CL_SUCCESS)
{
HandleCLError(err, "Error: can't get build log");
} else
{
ERROR_LOG(COMMON, "Error log:\n%s\n", buildlog);
}
delete[] buildlog;
return NULL; return NULL;
} }