! \brief Gets a list of devices for this platform. * * Wraps clGetDeviceIDs(). */
| 2223 | * Wraps clGetDeviceIDs(). |
| 2224 | */ |
| 2225 | cl_int getDevices( |
| 2226 | cl_device_type type, |
| 2227 | VECTOR_CLASS<Device>* devices) const |
| 2228 | { |
| 2229 | cl_uint n = 0; |
| 2230 | if( devices == NULL ) { |
| 2231 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR); |
| 2232 | } |
| 2233 | cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n); |
| 2234 | if (err != CL_SUCCESS) { |
| 2235 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR); |
| 2236 | } |
| 2237 | |
| 2238 | cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id)); |
| 2239 | err = ::clGetDeviceIDs(object_, type, n, ids, NULL); |
| 2240 | if (err != CL_SUCCESS) { |
| 2241 | return detail::errHandler(err, __GET_DEVICE_IDS_ERR); |
| 2242 | } |
| 2243 | |
| 2244 | devices->assign(&ids[0], &ids[n]); |
| 2245 | return CL_SUCCESS; |
| 2246 | } |
| 2247 | |
| 2248 | #if defined(USE_DX_INTEROP) |
| 2249 | /*! \brief Get the list of available D3D10 devices. |