! \brief Gets a list of available platforms. * * Wraps clGetPlatformIDs(). */
| 2327 | * Wraps clGetPlatformIDs(). |
| 2328 | */ |
| 2329 | static cl_int get( |
| 2330 | VECTOR_CLASS<Platform>* platforms) |
| 2331 | { |
| 2332 | cl_uint n = 0; |
| 2333 | |
| 2334 | if( platforms == NULL ) { |
| 2335 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR); |
| 2336 | } |
| 2337 | |
| 2338 | cl_int err = ::clGetPlatformIDs(0, NULL, &n); |
| 2339 | if (err != CL_SUCCESS) { |
| 2340 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR); |
| 2341 | } |
| 2342 | |
| 2343 | cl_platform_id* ids = (cl_platform_id*) alloca( |
| 2344 | n * sizeof(cl_platform_id)); |
| 2345 | err = ::clGetPlatformIDs(n, ids, NULL); |
| 2346 | if (err != CL_SUCCESS) { |
| 2347 | return detail::errHandler(err, __GET_PLATFORM_IDS_ERR); |
| 2348 | } |
| 2349 | |
| 2350 | platforms->assign(&ids[0], &ids[n]); |
| 2351 | return CL_SUCCESS; |
| 2352 | } |
| 2353 | |
| 2354 | /*! \brief Gets the first available platform. |
| 2355 | * |
nothing calls this directly
no test coverage detected