! \brief Constructs a context including a list of specified devices. * * Wraps clCreateContext(). */
| 2474 | * Wraps clCreateContext(). |
| 2475 | */ |
| 2476 | Context( |
| 2477 | const VECTOR_CLASS<Device>& devices, |
| 2478 | cl_context_properties* properties = NULL, |
| 2479 | void (CL_CALLBACK * notifyFptr)( |
| 2480 | const char *, |
| 2481 | const void *, |
| 2482 | ::size_t, |
| 2483 | void *) = NULL, |
| 2484 | void* data = NULL, |
| 2485 | cl_int* err = NULL) |
| 2486 | { |
| 2487 | cl_int error; |
| 2488 | |
| 2489 | ::size_t numDevices = devices.size(); |
| 2490 | cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id)); |
| 2491 | for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) { |
| 2492 | deviceIDs[deviceIndex] = (devices[deviceIndex])(); |
| 2493 | } |
| 2494 | |
| 2495 | object_ = ::clCreateContext( |
| 2496 | properties, (cl_uint) numDevices, |
| 2497 | deviceIDs, |
| 2498 | notifyFptr, data, &error); |
| 2499 | |
| 2500 | detail::errHandler(error, __CREATE_CONTEXT_ERR); |
| 2501 | if (err != NULL) { |
| 2502 | *err = error; |
| 2503 | } |
| 2504 | } |
| 2505 | |
| 2506 | Context( |
| 2507 | const Device& device, |
nothing calls this directly
no test coverage detected