! \brief Constructs a context including a list of specified devices. * * Wraps clCreateContext(). */
| 3103 | * Wraps clCreateContext(). |
| 3104 | */ |
| 3105 | Context( |
| 3106 | const vector<Device>& devices, |
| 3107 | const cl_context_properties* properties = nullptr, |
| 3108 | void (CL_CALLBACK * notifyFptr)( |
| 3109 | const char *, |
| 3110 | const void *, |
| 3111 | size_type, |
| 3112 | void *) = nullptr, |
| 3113 | void* data = nullptr, |
| 3114 | cl_int* err = nullptr) |
| 3115 | { |
| 3116 | cl_int error; |
| 3117 | |
| 3118 | size_type numDevices = devices.size(); |
| 3119 | vector<cl_device_id> deviceIDs(numDevices); |
| 3120 | |
| 3121 | for( size_type deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) { |
| 3122 | deviceIDs[deviceIndex] = (devices[deviceIndex])(); |
| 3123 | } |
| 3124 | |
| 3125 | object_ = ::clCreateContext( |
| 3126 | properties, (cl_uint) numDevices, |
| 3127 | deviceIDs.data(), |
| 3128 | notifyFptr, data, &error); |
| 3129 | |
| 3130 | detail::errHandler(error, __CREATE_CONTEXT_ERR); |
| 3131 | if (err != nullptr) { |
| 3132 | *err = error; |
| 3133 | } |
| 3134 | } |
| 3135 | |
| 3136 | /*! \brief Constructs a context including a specific device. |
| 3137 | * |
nothing calls this directly
no test coverage detected