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
@@ -1650,6 +1662,19 @@ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_)
1650
1662
CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_ (CL_HPP_DECLARE_PARAM_TRAITS_)
1651
1663
#endif // cl_khr_external_semaphore
1652
1664
1665
+ #if defined(cl_khr_external_semaphore_dx_fence)
1666
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1667
+ #endif // cl_khr_external_semaphore_dx_fence
1668
+ #if defined(cl_khr_external_semaphore_opaque_fd)
1669
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1670
+ #endif // cl_khr_external_semaphore_opaque_fd
1671
+ #if defined(cl_khr_external_semaphore_sync_fd)
1672
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1673
+ #endif // cl_khr_external_semaphore_sync_fd
1674
+ #if defined(cl_khr_external_semaphore_win32)
1675
+ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXT (CL_HPP_DECLARE_PARAM_TRAITS_)
1676
+ #endif // cl_khr_external_semaphore_win32
1677
+
1653
1678
#if defined(cl_khr_device_uuid)
1654
1679
using uuid_array = array<cl_uchar, CL_UUID_SIZE_KHR>;
1655
1680
using luid_array = array<cl_uchar, CL_LUID_SIZE_KHR>;
@@ -2014,6 +2039,17 @@ struct ReferenceHandler<cl_event>
2014
2039
{ return CL_ (clReleaseEvent)(event); }
2015
2040
};
2016
2041
2042
+ #ifdef cl_khr_semaphore
2043
+ template <>
2044
+ struct ReferenceHandler <cl_semaphore_khr>
2045
+ {
2046
+ static cl_int retain (cl_semaphore_khr semaphore)
2047
+ { return CL_ (clRetainSemaphoreKHR)(semaphore); }
2048
+
2049
+ static cl_int release (cl_semaphore_khr semaphore)
2050
+ { return CL_ (clReleaseSemaphoreKHR)(semaphore); }
2051
+ };
2052
+ #endif // cl_khr_semaphore
2017
2053
#if defined(cl_khr_command_buffer)
2018
2054
template <>
2019
2055
struct ReferenceHandler <cl_command_buffer_khr>
@@ -2023,6 +2059,17 @@ struct ReferenceHandler<cl_command_buffer_khr>
2023
2059
static cl_int release (cl_command_buffer_khr cmdbuf)
2024
2060
{ return CL_ (clReleaseCommandBufferKHR)(cmdbuf); }
2025
2061
};
2062
+
2063
+ template <>
2064
+ struct ReferenceHandler <cl_mutable_command_khr>
2065
+ {
2066
+ // cl_mutable_command_khr does not have retain().
2067
+ static cl_int retain (cl_mutable_command_khr)
2068
+ { return CL_SUCCESS; }
2069
+ // cl_mutable_command_khr does not have release().
2070
+ static cl_int release (cl_mutable_command_khr)
2071
+ { return CL_SUCCESS; }
2072
+ };
2026
2073
#endif // cl_khr_command_buffer
2027
2074
2028
2075
@@ -10993,60 +11040,24 @@ namespace compatibility {
10993
11040
10994
11041
10995
11042
#if defined(cl_khr_command_buffer)
10996
-
10997
11043
/* ! \class CommandBuffer
10998
11044
* \brief CommandBuffer interface for cl_command_buffer_khr.
10999
11045
*/
11000
11046
class CommandBuffer : public detail ::Wrapper<cl_command_buffer_khr>
11001
11047
{
11002
11048
public:
11003
- CommandBuffer () {}
11049
+ // ! \brief Default constructor - initializes to nullptr.
11050
+ CommandBuffer () : detail::Wrapper<cl_type>() { }
11004
11051
11005
- /* ! \brief Constructor from cl_command_queue - takes ownership.
11006
- *
11007
- * \param retainObject will cause the constructor to retain its cl object.
11008
- * Defaults to false to maintain compatibility with
11009
- * earlier versions.
11010
- */
11011
11052
explicit CommandBuffer (cl_command_buffer_khr cmdbuf, bool retainObject = false ) :
11012
11053
detail::Wrapper<cl_type>(cmdbuf, retainObject) { }
11013
11054
11014
- // TODO: other overloads!
11015
-
11016
11055
CommandBuffer& operator = (const cl_command_buffer_khr& rhs)
11017
11056
{
11018
11057
detail::Wrapper<cl_type>::operator =(rhs);
11019
11058
return *this ;
11020
11059
}
11021
11060
11022
- /* ! \brief Copy constructor to forward copy to the superclass correctly.
11023
- * Required for MSVC.
11024
- */
11025
- CommandBuffer (const CommandBuffer& cmdbuf) : detail::Wrapper<cl_type>(cmdbuf) {}
11026
-
11027
- /* ! \brief Copy assignment to forward copy to the superclass correctly.
11028
- * Required for MSVC.
11029
- */
11030
- CommandBuffer& operator = (const CommandBuffer& cmdbuf)
11031
- {
11032
- detail::Wrapper<cl_type>::operator =(cmdbuf);
11033
- return *this ;
11034
- }
11035
-
11036
- /* ! \brief Move constructor to forward move to the superclass correctly.
11037
- * Required for MSVC.
11038
- */
11039
- CommandBuffer (CommandBuffer&& cmdbuf) noexcept : detail::Wrapper<cl_type>(std::move(cmdbuf)) {}
11040
-
11041
- /* ! \brief Move assignment to forward move to the superclass correctly.
11042
- * Required for MSVC.
11043
- */
11044
- CommandBuffer& operator = (CommandBuffer &&cmdbuf)
11045
- {
11046
- detail::Wrapper<cl_type>::operator =(std::move (cmdbuf));
11047
- return *this ;
11048
- }
11049
-
11050
11061
template <typename T>
11051
11062
cl_int getInfo (cl_command_buffer_info_khr name, T* param) const
11052
11063
{
@@ -11057,8 +11068,8 @@ class CommandBuffer : public detail::Wrapper<cl_command_buffer_khr>
11057
11068
}
11058
11069
11059
11070
template <cl_command_buffer_info_khr name> typename
11060
- detail::param_traits<detail::cl_command_buffer_info_khr, name>::param_type
11061
- getInfo (cl_int* err = nullptr ) const
11071
+ detail::param_traits<detail::cl_command_buffer_info_khr, name>::param_type
11072
+ getInfo (cl_int* err = nullptr ) const
11062
11073
{
11063
11074
typename detail::param_traits<
11064
11075
detail::cl_command_buffer_info_khr, name>::param_type param{};
@@ -11069,7 +11080,7 @@ class CommandBuffer : public detail::Wrapper<cl_command_buffer_khr>
11069
11080
return param;
11070
11081
}
11071
11082
11072
- cl_int finalize (void )
11083
+ cl_int finalize () const
11073
11084
{
11074
11085
return detail::errHandler (
11075
11086
CL_ (clFinalizeCommandBufferKHR)(object_),
0 commit comments