What I want to do is
Render a Image using openGL
process the image using several CL devices.
However I run into problems when trying to create context that contains several devices when i create the context from OpenGL.
My code look like this:
cl_int err;
cl_platform_id platforms[10];
cl_uint nrPlatforms;
err = clGetPlatformIDs(10, platforms,&nrPlatforms );
CL_REPORT_IF_ERROR(err)
cl_uint maxDevices = 100;
cl_device_id* devices = new cl_device_id[maxDevices];
cl_uint nrDevices;
err = clGetDeviceIDs(platforms[0], deviceType, maxDevices, devices, &nrDevices);
CL_REPORT_IF_ERROR(err)
cl_context_properties props[] =
{
CL_GL_CONTEXT_KHR, gcAdapter->getCL_GL_CONTEXT_KHR(), // The gl context handel
CL_WGL_HDC_KHR, gcAdapter->getCL_WGL_HDC_KHR(), //
0
};
cl_context gl_to_cl_context;
gl_to_cl_context = clCreateContext(props, nrDevices,
devices, NULL, NULL, &err);
//Error CL_INVALID_OPERATION
CL_REPORT_IF_ERROR(err)
// Set the context
_context = gl_to_cl_context;
if i replace
gl_to_cl_context = clCreateContext(props, nrDevices,
devices, NULL, NULL, &err);
with:
gl_to_cl_context = clCreateContext(props, 1,
devices[0], NULL, NULL, &err);
or
gl_to_cl_context = clCreateContext(props, 1,
devices[1], NULL, NULL, &err);
No error is reported and everything is working.
But I whant to use several devices External Image or:
Is it even possible to use several devices operating on gl Recourses?
OS: is XP
cards: 2x NVIDIA GTX 480
cl driver: 197.41
cl develop: cuda 3.0
Im using osg to handle openGL calls