173
173
* Enable exceptions for use in the C++ bindings header. This is the
174
174
* preferred error handling mechanism but is not required.
175
175
*
176
+ * - CL_HPP_CUSTOM_EXCEPTION_TYPE
177
+ *
178
+ * Specify the type which should be used for exceptions. This type
179
+ * must have a constructor accepting an int and a const char*.
180
+ *
176
181
* - CL_HPP_ENABLE_SIZE_T_COMPATIBILITY
177
182
*
178
183
* Backward compatibility option to support cl.hpp-style size_t
@@ -740,6 +745,7 @@ namespace cl {
740
745
#endif // cl_khr_command_buffer
741
746
742
747
#if defined(CL_HPP_ENABLE_EXCEPTIONS)
748
+ #if !defined(CL_HPP_CUSTOM_EXCEPTION_TYPE)
743
749
/* ! \brief Exception class
744
750
*
745
751
* This may be thrown by API functions when CL_HPP_ENABLE_EXCEPTIONS is defined.
@@ -782,6 +788,9 @@ namespace cl {
782
788
*/
783
789
cl_int err (void ) const { return err_; }
784
790
};
791
+ #else
792
+ using Error = CL_HPP_CUSTOM_EXCEPTION_TYPE;
793
+ #endif
785
794
#define CL_HPP_ERR_STR_ (x ) #x
786
795
#else
787
796
#define CL_HPP_ERR_STR_ (x ) nullptr
@@ -1501,6 +1510,9 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_
1501
1510
F (cl_device_info, CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector<cl_external_semaphore_handle_type_khr>) \
1502
1511
F (cl_semaphore_info_khr, CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector<cl_external_semaphore_handle_type_khr>) \
1503
1512
1513
+ #define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXT (F ) \
1514
+ F (cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR, void *) \
1515
+
1504
1516
#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT (F ) \
1505
1517
F (cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR, int ) \
1506
1518
@@ -1663,6 +1675,19 @@ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_)
1663
1675
CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_ (CL_HPP_DECLARE_PARAM_TRAITS_)
1664
1676
#endif // cl_khr_external_semaphore
1665
1677
1678
+ #if defined(cl_khr_external_semaphore_dx_fence)
1679
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1680
+ #endif // cl_khr_external_semaphore_dx_fence
1681
+ #if defined(cl_khr_external_semaphore_opaque_fd)
1682
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1683
+ #endif // cl_khr_external_semaphore_opaque_fd
1684
+ #if defined(cl_khr_external_semaphore_sync_fd)
1685
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1686
+ #endif // cl_khr_external_semaphore_sync_fd
1687
+ #if defined(cl_khr_external_semaphore_win32)
1688
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1689
+ #endif // cl_khr_external_semaphore_win32
1690
+
1666
1691
#if defined(cl_khr_device_uuid)
1667
1692
using uuid_array = array<cl_uchar, CL_UUID_SIZE_KHR>;
1668
1693
using luid_array = array<cl_uchar, CL_LUID_SIZE_KHR>;
@@ -2031,6 +2056,17 @@ struct ReferenceHandler<cl_event>
2031
2056
{ return CL_ (clReleaseEvent)(event); }
2032
2057
};
2033
2058
2059
+ #ifdef cl_khr_semaphore
2060
+ template <>
2061
+ struct ReferenceHandler <cl_semaphore_khr>
2062
+ {
2063
+ static cl_int retain (cl_semaphore_khr semaphore)
2064
+ { return CL_ (clRetainSemaphoreKHR)(semaphore); }
2065
+
2066
+ static cl_int release (cl_semaphore_khr semaphore)
2067
+ { return CL_ (clReleaseSemaphoreKHR)(semaphore); }
2068
+ };
2069
+ #endif // cl_khr_semaphore
2034
2070
#if defined(cl_khr_command_buffer)
2035
2071
template <>
2036
2072
struct ReferenceHandler <cl_command_buffer_khr>
@@ -2040,6 +2076,17 @@ struct ReferenceHandler<cl_command_buffer_khr>
2040
2076
static cl_int release (cl_command_buffer_khr cmdbuf)
2041
2077
{ return CL_ (clReleaseCommandBufferKHR)(cmdbuf); }
2042
2078
};
2079
+
2080
+ template <>
2081
+ struct ReferenceHandler <cl_mutable_command_khr>
2082
+ {
2083
+ // cl_mutable_command_khr does not have retain().
2084
+ static cl_int retain (cl_mutable_command_khr)
2085
+ { return CL_SUCCESS; }
2086
+ // cl_mutable_command_khr does not have release().
2087
+ static cl_int release (cl_mutable_command_khr)
2088
+ { return CL_SUCCESS; }
2089
+ };
2043
2090
#endif // cl_khr_command_buffer
2044
2091
2045
2092
@@ -11010,60 +11057,24 @@ namespace compatibility {
11010
11057
11011
11058
11012
11059
#if defined(cl_khr_command_buffer)
11013
-
11014
11060
/* ! \class CommandBuffer
11015
11061
* \brief CommandBuffer interface for cl_command_buffer_khr.
11016
11062
*/
11017
11063
class CommandBuffer : public detail ::Wrapper<cl_command_buffer_khr>
11018
11064
{
11019
11065
public:
11020
- CommandBuffer () {}
11066
+ // ! \brief Default constructor - initializes to nullptr.
11067
+ CommandBuffer () : detail::Wrapper<cl_type>() { }
11021
11068
11022
- /* ! \brief Constructor from cl_command_queue - takes ownership.
11023
- *
11024
- * \param retainObject will cause the constructor to retain its cl object.
11025
- * Defaults to false to maintain compatibility with
11026
- * earlier versions.
11027
- */
11028
11069
explicit CommandBuffer (cl_command_buffer_khr cmdbuf, bool retainObject = false ) :
11029
11070
detail::Wrapper<cl_type>(cmdbuf, retainObject) { }
11030
11071
11031
- // TODO: other overloads!
11032
-
11033
11072
CommandBuffer& operator = (const cl_command_buffer_khr& rhs)
11034
11073
{
11035
11074
detail::Wrapper<cl_type>::operator =(rhs);
11036
11075
return *this ;
11037
11076
}
11038
11077
11039
- /* ! \brief Copy constructor to forward copy to the superclass correctly.
11040
- * Required for MSVC.
11041
- */
11042
- CommandBuffer (const CommandBuffer& cmdbuf) : detail::Wrapper<cl_type>(cmdbuf) {}
11043
-
11044
- /* ! \brief Copy assignment to forward copy to the superclass correctly.
11045
- * Required for MSVC.
11046
- */
11047
- CommandBuffer& operator = (const CommandBuffer& cmdbuf)
11048
- {
11049
- detail::Wrapper<cl_type>::operator =(cmdbuf);
11050
- return *this ;
11051
- }
11052
-
11053
- /* ! \brief Move constructor to forward move to the superclass correctly.
11054
- * Required for MSVC.
11055
- */
11056
- CommandBuffer (CommandBuffer&& cmdbuf) noexcept : detail::Wrapper<cl_type>(std::move(cmdbuf)) {}
11057
-
11058
- /* ! \brief Move assignment to forward move to the superclass correctly.
11059
- * Required for MSVC.
11060
- */
11061
- CommandBuffer& operator = (CommandBuffer &&cmdbuf)
11062
- {
11063
- detail::Wrapper<cl_type>::operator =(std::move (cmdbuf));
11064
- return *this ;
11065
- }
11066
-
11067
11078
template <typename T>
11068
11079
cl_int getInfo (cl_command_buffer_info_khr name, T* param) const
11069
11080
{
@@ -11074,8 +11085,8 @@ class CommandBuffer : public detail::Wrapper<cl_command_buffer_khr>
11074
11085
}
11075
11086
11076
11087
template <cl_command_buffer_info_khr name> typename
11077
- detail::param_traits<detail::cl_command_buffer_info_khr, name>::param_type
11078
- getInfo (cl_int* err = nullptr ) const
11088
+ detail::param_traits<detail::cl_command_buffer_info_khr, name>::param_type
11089
+ getInfo (cl_int* err = nullptr ) const
11079
11090
{
11080
11091
typename detail::param_traits<
11081
11092
detail::cl_command_buffer_info_khr, name>::param_type param{};
@@ -11086,7 +11097,7 @@ class CommandBuffer : public detail::Wrapper<cl_command_buffer_khr>
11086
11097
return param;
11087
11098
}
11088
11099
11089
- cl_int finalize (void )
11100
+ cl_int finalize () const
11090
11101
{
11091
11102
return detail::errHandler (
11092
11103
CL_ (clFinalizeCommandBufferKHR)(object_),
0 commit comments