| 206 | } |
| 207 | |
| 208 | cl_program MakeProgram( cl_device_id device, const char *source[], int count ) |
| 209 | { |
| 210 | int error; |
| 211 | int i; |
| 212 | |
| 213 | //create the program |
| 214 | cl_program program; |
| 215 | error = create_single_kernel_helper_create_program(gContext, &program, (cl_uint)count, source); |
| 216 | if( NULL == program ) |
| 217 | { |
| 218 | vlog_error( "\t\tFAILED -- Failed to create program. (%d)\n", error ); |
| 219 | return NULL; |
| 220 | } |
| 221 | |
| 222 | // build it |
| 223 | if( (error = clBuildProgram( program, 1, &device, NULL, NULL, NULL )) ) |
| 224 | { |
| 225 | size_t len; |
| 226 | char buffer[16384]; |
| 227 | |
| 228 | vlog_error("\t\tFAILED -- clBuildProgramExecutable() failed:\n"); |
| 229 | clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len); |
| 230 | vlog_error("Log: %s\n", buffer); |
| 231 | vlog_error("Source :\n"); |
| 232 | for(i = 0; i < count; ++i) { |
| 233 | vlog_error("%s", source[i]); |
| 234 | } |
| 235 | vlog_error("\n"); |
| 236 | |
| 237 | clReleaseProgram( program ); |
| 238 | return NULL; |
| 239 | } |
| 240 | |
| 241 | return program; |
| 242 | } |
| 243 | |
| 244 | void ReleaseCL(void) |
| 245 | { |