! \brief Gets a list of supported image formats. * * Wraps clGetSupportedImageFormats(). */
| 3329 | * Wraps clGetSupportedImageFormats(). |
| 3330 | */ |
| 3331 | cl_int getSupportedImageFormats( |
| 3332 | cl_mem_flags flags, |
| 3333 | cl_mem_object_type type, |
| 3334 | vector<ImageFormat>* formats) const |
| 3335 | { |
| 3336 | cl_uint numEntries; |
| 3337 | |
| 3338 | if (!formats) { |
| 3339 | return CL_SUCCESS; |
| 3340 | } |
| 3341 | |
| 3342 | cl_int err = ::clGetSupportedImageFormats( |
| 3343 | object_, |
| 3344 | flags, |
| 3345 | type, |
| 3346 | 0, |
| 3347 | nullptr, |
| 3348 | &numEntries); |
| 3349 | if (err != CL_SUCCESS) { |
| 3350 | return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR); |
| 3351 | } |
| 3352 | |
| 3353 | if (numEntries > 0) { |
| 3354 | vector<ImageFormat> value(numEntries); |
| 3355 | err = ::clGetSupportedImageFormats( |
| 3356 | object_, |
| 3357 | flags, |
| 3358 | type, |
| 3359 | numEntries, |
| 3360 | (cl_image_format*)value.data(), |
| 3361 | nullptr); |
| 3362 | if (err != CL_SUCCESS) { |
| 3363 | return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR); |
| 3364 | } |
| 3365 | |
| 3366 | formats->assign(begin(value), end(value)); |
| 3367 | } |
| 3368 | else { |
| 3369 | // If no values are being returned, ensure an empty vector comes back |
| 3370 | formats->clear(); |
| 3371 | } |
| 3372 | |
| 3373 | return CL_SUCCESS; |
| 3374 | } |
| 3375 | |
| 3376 | #if CL_HPP_TARGET_OPENCL_VERSION >= 300 |
| 3377 | /*! \brief Registers a destructor callback function with a context. |
nothing calls this directly
no test coverage detected