clray

diff src/ocl.cc @ 2:41d6253492ad

pfffff
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 12 Jul 2010 10:38:07 +0300
parents 0b0e4d18d53f
children deaf85acf6af
line diff
     1.1 --- a/src/ocl.cc	Mon Jul 12 07:00:19 2010 +0300
     1.2 +++ b/src/ocl.cc	Mon Jul 12 10:38:07 2010 +0300
     1.3 @@ -242,12 +242,16 @@
     1.4  
     1.5  bool CLProgram::build()
     1.6  {
     1.7 -	char errlog[512];
     1.8 +	int err;
     1.9  
    1.10 +	if((err = clBuildProgram(prog, 0, 0, 0, 0, 0)) != 0) {
    1.11 +		size_t sz;
    1.12 +		clGetProgramBuildInfo(prog, devinf.id, CL_PROGRAM_BUILD_LOG, 0, 0, &sz);
    1.13  
    1.14 -	if(clBuildProgram(prog, 0, 0, 0, 0, 0) != 0) {
    1.15 -		clGetProgramBuildInfo(prog, devinf.id, CL_PROGRAM_BUILD_LOG, sizeof errlog, errlog, 0);
    1.16 -		fprintf(stderr, "failed to build program:\n%s\n", errlog);
    1.17 +		char *errlog = (char*)alloca(sz + 1);
    1.18 +		clGetProgramBuildInfo(prog, devinf.id, CL_PROGRAM_BUILD_LOG, sz, errlog, 0);
    1.19 +		fprintf(stderr, "failed to build program: (%d)\n%s\n", err, errlog);
    1.20 +
    1.21  		clReleaseProgram(prog);
    1.22  		prog = 0;
    1.23  		return false;