+
+ void setDevice(Info &oclinfo, int devnum)
+ {
+ CV_Assert(devnum >= 0);
+ cl_int status = 0;
+ cl_context_properties cps[3] =
+ {
+ CL_CONTEXT_PLATFORM, (cl_context_properties)(oclinfo.impl->oclplatform), 0
+ };
+ oclinfo.impl->devnum = devnum;
+ oclinfo.impl->oclcontext = clCreateContext(cps, 1, &oclinfo.impl->devices[devnum], NULL, NULL, &status);
+ openCLVerifyCall(status);
+ //create the command queue using the first device of the list
+ oclinfo.impl->clCmdQueue = clCreateCommandQueue(oclinfo.impl->oclcontext, oclinfo.impl->devices[devnum],
+ CL_QUEUE_PROFILING_ENABLE, &status);
+ openCLVerifyCall(status);
+ fillClcontext(oclinfo);
+ }
+
+ void setDeviceEx(Info &oclinfo, void *ctx, void *q, int devnum)
+ {
+ CV_Assert(devnum >= 0);
+ oclinfo.impl->devnum = devnum;
+ if(ctx && q)
+ {
+ oclinfo.impl->oclcontext = (cl_context)ctx;
+ oclinfo.impl->clCmdQueue = (cl_command_queue)q;
+ clRetainContext((cl_context)ctx);
+ clRetainCommandQueue((cl_command_queue)q);
+ fillClcontext(oclinfo);
+ }
+ }
+