@@ -2882,12 +2882,9 @@ class Platform : public detail::Wrapper<cl_platform_id>
28822882 */
28832883 cl_int getDevices (
28842884 cl_device_type type,
2885- vector<Device>* devices) const
2885+ vector<Device>& devices) const
28862886 {
28872887 cl_uint n = 0 ;
2888- if ( devices == nullptr ) {
2889- return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2890- }
28912888 cl_int err = CL_ (clGetDeviceIDs)(object_, type, 0 , nullptr , &n);
28922889 if (err != CL_SUCCESS && err != CL_DEVICE_NOT_FOUND) {
28932890 return detail::errHandler (err, __GET_DEVICE_IDS_ERR);
@@ -2905,18 +2902,31 @@ class Platform : public detail::Wrapper<cl_platform_id>
29052902 // with safe construction
29062903 // We must retain things we obtain from the API to avoid releasing
29072904 // API-owned objects.
2908- if (devices) {
2909- devices->resize (ids.size ());
2905+ devices.resize (ids.size ());
29102906
2911- // Assign to param, constructing with retain behaviour
2912- // to correctly capture each underlying CL object
2913- for (size_type i = 0 ; i < ids.size (); i++) {
2914- (*devices)[i] = Device (ids[i], true );
2915- }
2907+ // Assign to param, constructing with retain behaviour
2908+ // to correctly capture each underlying CL object
2909+ for (size_type i = 0 ; i < ids.size (); i++) {
2910+ devices[i] = Device (ids[i], true );
29162911 }
29172912 return CL_SUCCESS;
29182913 }
29192914
2915+ /* ! \brief Gets a list of devices for this platform.
2916+ *
2917+ * Pointer overload for backwards compatibility.
2918+ */
2919+ cl_int getDevices (
2920+ cl_device_type type,
2921+ vector<Device>* devices) const
2922+ {
2923+ if ( devices == nullptr ) {
2924+ return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2925+ }
2926+
2927+ return getDevices (type, *devices);
2928+ }
2929+
29202930#if defined(CL_HPP_USE_DX_INTEROP)
29212931 /* ! \brief Get the list of available D3D10 devices.
29222932 *
@@ -2945,7 +2955,7 @@ class Platform : public detail::Wrapper<cl_platform_id>
29452955 cl_d3d10_device_source_khr d3d_device_source,
29462956 void * d3d_object,
29472957 cl_d3d10_device_set_khr d3d_device_set,
2948- vector<Device>* devices) const
2958+ vector<Device>& devices) const
29492959 {
29502960 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
29512961 cl_platform_id platform,
@@ -2956,10 +2966,6 @@ class Platform : public detail::Wrapper<cl_platform_id>
29562966 cl_device_id * devices,
29572967 cl_uint* num_devices);
29582968
2959- if ( devices == nullptr ) {
2960- return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2961- }
2962-
29632969 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = nullptr ;
29642970#if CL_HPP_TARGET_OPENCL_VERSION >= 120
29652971 CL_HPP_INIT_CL_EXT_FCN_PTR_PLATFORM_ (object_, clGetDeviceIDsFromD3D10KHR);
@@ -2998,32 +3004,43 @@ class Platform : public detail::Wrapper<cl_platform_id>
29983004 // with safe construction
29993005 // We must retain things we obtain from the API to avoid releasing
30003006 // API-owned objects.
3001- if (devices) {
3002- devices->resize (ids.size ());
3007+ devices.resize (ids.size ());
30033008
3004- // Assign to param, constructing with retain behaviour
3005- // to correctly capture each underlying CL object
3006- for (size_type i = 0 ; i < ids.size (); i++) {
3007- (*devices)[i] = Device (ids[i], true );
3008- }
3009+ // Assign to param, constructing with retain behaviour
3010+ // to correctly capture each underlying CL object
3011+ for (size_type i = 0 ; i < ids.size (); i++) {
3012+ devices[i] = Device (ids[i], true );
30093013 }
30103014 return CL_SUCCESS;
30113015 }
3016+
3017+ /* ! \brief Get the list of available D3D10 devices.
3018+ *
3019+ * Pointer overload for backwards compatibility.
3020+ */
3021+ cl_int getDevices (
3022+ cl_d3d10_device_source_khr d3d_device_source,
3023+ void * d3d_object,
3024+ cl_d3d10_device_set_khr d3d_device_set,
3025+ vector<Device>* devices) const
3026+ {
3027+ if ( devices == nullptr ) {
3028+ return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
3029+ }
3030+
3031+ return getDevices (d3d_device_source, d3d_object, d3d_device_set, *devices);
3032+ }
30123033#endif
30133034
30143035 /* ! \brief Gets a list of available platforms.
30153036 *
30163037 * Wraps clGetPlatformIDs().
30173038 */
30183039 static cl_int get (
3019- vector<Platform>* platforms)
3040+ vector<Platform>& platforms)
30203041 {
30213042 cl_uint n = 0 ;
30223043
3023- if ( platforms == nullptr ) {
3024- return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
3025- }
3026-
30273044 cl_int err = CL_ (clGetPlatformIDs)(0 , nullptr , &n);
30283045 if (err != CL_SUCCESS) {
30293046 return detail::errHandler (err, __GET_PLATFORM_IDS_ERR);
@@ -3035,17 +3052,29 @@ class Platform : public detail::Wrapper<cl_platform_id>
30353052 return detail::errHandler (err, __GET_PLATFORM_IDS_ERR);
30363053 }
30373054
3038- if (platforms) {
3039- platforms->resize (ids.size ());
3055+ platforms.resize (ids.size ());
30403056
3041- // Platforms don't reference count
3042- for (size_type i = 0 ; i < ids.size (); i++) {
3043- (*platforms)[i] = Platform (ids[i]);
3044- }
3057+ // Platforms don't reference count
3058+ for (size_type i = 0 ; i < ids.size (); i++) {
3059+ platforms[i] = Platform (ids[i]);
30453060 }
30463061 return CL_SUCCESS;
30473062 }
30483063
3064+ /* ! \brief Gets a list of available platforms.
3065+ *
3066+ * Pointer overload for backwards compatibility.
3067+ */
3068+ static cl_int get (
3069+ vector<Platform>* platforms)
3070+ {
3071+ if ( platforms == nullptr ) {
3072+ return detail::errHandler (CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
3073+ }
3074+
3075+ return get (*platforms);
3076+ }
3077+
30493078 /* ! \brief Gets the first available platform.
30503079 *
30513080 * Wraps clGetPlatformIDs(), returning the first result.
@@ -3572,13 +3601,9 @@ class Context
35723601 cl_int getSupportedImageFormats (
35733602 cl_mem_flags flags,
35743603 cl_mem_object_type type,
3575- vector<ImageFormat>* formats) const
3604+ vector<ImageFormat>& formats) const
35763605 {
35773606 cl_uint numEntries;
3578-
3579- if (!formats) {
3580- return CL_SUCCESS;
3581- }
35823607
35833608 cl_int err = CL_ (clGetSupportedImageFormats)(
35843609 object_,
@@ -3604,16 +3629,31 @@ class Context
36043629 return detail::errHandler (err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
36053630 }
36063631
3607- formats-> assign (value.begin (), value.end ());
3632+ formats. assign (value.begin (), value.end ());
36083633 }
36093634 else {
36103635 // If no values are being returned, ensure an empty vector comes back
3611- formats-> clear ();
3636+ formats. clear ();
36123637 }
36133638
36143639 return CL_SUCCESS;
36153640 }
36163641
3642+ /* ! \brief Gets a list of supported image formats.
3643+ *
3644+ * Pointer overload for backwards compatibility.
3645+ */
3646+ cl_int getSupportedImageFormats (
3647+ cl_mem_flags flags,
3648+ cl_mem_object_type type,
3649+ vector<ImageFormat>* formats) const
3650+ {
3651+ if (!formats) {
3652+ return CL_SUCCESS;
3653+ }
3654+ return getSupportedImageFormats (flags, type, *formats);
3655+ }
3656+
36173657#if defined(cl_ext_image_requirements_info)
36183658 template <typename T>
36193659 cl_int getImageRequirementsInfoExt (cl_image_requirements_info_ext name,
0 commit comments