Hi
I am having an annoying problem.
When I create one kernel from one file and enque it, everything works, But when i load 2 files, 2 kernels into a kernel buffer, it wont enque.
My code that works:
const char *file_names[] = { "RayTracer.cl" };
const int NUMBER_OF_FILES = 1;
char* buffer[1];
size_t sizes[1];
loadProgramSource(file_names, NUMBER_OF_FILES, buffer, sizes);
cl_program program = clCreateProgramWithSource(context, NUMBER_OF_FILES, (const char**)buffer, sizes, &error);
error = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
cl_uint numOfKernels;
clCreateKernelsInProgram(program, 0, NULL, &numOfKernels);
clCreateKernelsInProgram(program, numOfKernels, &kernel, NULL);
openglBuf = clCreateFromGLTexture(context, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D,0,texture,&error);
error = clSetKernelArg(kernel, 0, sizeof(openglBuf), &openglBuf);
error = clEnqueueNDRangeKernel(queue, kernel,
2,
NULL,
global_dim,
NULL, 0, NULL, NULL);
That works fine.
But when I load two files like below, I get an error 34 from the enqueND.
const char *file_names[] = { "RayTracer.cl", "movement.cl" };
const int NUMBER_OF_FILES = 2;
char* buffer[2];
size_t sizes[2];
loadProgramSource(file_names, NUMBER_OF_FILES, buffer, sizes);
cl_program program = clCreateProgramWithSource(context, NUMBER_OF_FILES, (const char**)buffer, sizes, &error);
error = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
cl_uint numOfKernels;
clCreateKernelsInProgram(program, 0, NULL, &numOfKernels);
kernels = (cl_kernel*)_alloca(sizeof(cl_kernel) * numOfKernels);
clCreateKernelsInProgram(program, numOfKernels, kernels, NULL);
openglBuf = clCreateFromGLTexture(context, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D,0,texture,&error);
error = clSetKernelArg(kernels[0], 0, sizeof(openglBuf), &openglBuf);
error = clEnqueueNDRangeKernel(queue, kernels[0],
2,
NULL,
global_dim,
NULL, 0, NULL, NULL);
What am i doing wrong?
I am using a cl_gl shared context incase that matters.
Any help would be greatly appreciated.
Thanks