Commit 74ef687d authored by Peter Eastman's avatar Peter Eastman
Browse files

Updated to latest version of cl.hpp

parent a8ceded2
......@@ -29,7 +29,7 @@
* Additions and fixes from Brian Cole, March 3rd 2010.
*
* \version 1.0
* \date March 2010
* \date $Date: 2010-04-23 10:16:50 -0500 (Fri, 23 Apr 2010) $
*
*/
......@@ -293,15 +293,9 @@
#endif
#endif // !__APPLE__
#if defined(_WIN32)
#define CL_API_ENTRY
#define CL_API_CALL __stdcall
#define CL_CALLBACK __stdcall
#else
#define CL_API_ENTRY
#define CL_API_CALL
#if !defined(CL_CALLBACK)
#define CL_CALLBACK
#endif
#endif //CL_CALLBACK
#include <utility>
......@@ -315,6 +309,8 @@
#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
# include <alloca.h>
#else
# include <malloc.h>
#endif // linux
#include <cstring>
......@@ -999,6 +995,30 @@ struct GetInfoHelper<Func, STRING_CLASS>
F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
#if defined(CL_VERSION_1_1)
#define __PARAM_NAME_INFO_1_1(F) \
F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
\
F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
\
F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
\
F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
#endif // CL_VERSION_1_1
template <typename enum_type, cl_int Name>
struct param_traits {};
......@@ -1012,6 +1032,9 @@ struct param_traits<detail:: token,param_name> \
};
__PARAM_NAME_INFO_1_0(__DECLARE_PARAM_TRAITS);
#if defined(CL_VERSION_1_1)
__PARAM_NAME_INFO_1_1(__DECLARE_PARAM_TRAITS);
#endif // CL_VERSION_1_1
#undef __DECLARE_PARAM_TRAITS
......@@ -1220,6 +1243,8 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
*/
struct ImageFormat : public cl_image_format
{
ImageFormat(){}
/*! \brief Create an image format.
*
* \param order
......@@ -1231,6 +1256,20 @@ struct ImageFormat : public cl_image_format
image_channel_order = order;
image_channel_data_type = type;
}
/*!
* \brief Assignment operator
*
* \param rhs the imageformat object on rhs of the assignment.
*/
ImageFormat& operator = (const ImageFormat& rhs)
{
if (this != &rhs) {
this->image_channel_data_type = rhs.image_channel_data_type;
this->image_channel_order = rhs.image_channel_order;
}
return *this;
}
};
/*! \class Device
......@@ -2001,6 +2040,65 @@ public:
__WAIT_FOR_EVENTS_ERR);
}
#if defined(CL_VERSION_1_1)
/*!
* \brief Register a user callback function.
*
* \param type specifies the command execution status for which the callback
* is registered. The command execution callback mask values for which a
* callback can be registered are: CL_COMPLETE. There is no guarantee that
* the callback functions registered for various execution status values for
* an event will be called in the exact order that the execution status of a
* command changes.
*
* \param pfn_event_notify is the event callback function that can be
* registered by the application. This callback function may be called
* asynchronously by the OpenCL implementation. It is the application�s
* responsibility to ensure that the callback function is thread-safe.
* The parameters to this callback function are:
*
* - event is the event object for which the callback function is invoked.
* - event_command_exec_status represents the execution status of command
* for which this callback function is invoked. Refer to table 5.15 for
* the command execution status values. If the callback is called as the
* result of the command associated with event being abnormally terminated,
* an appropriate error code for the error that caused the termination
* will be passed to event_command_exec_status instead.
* - user_data is a pointer to user supplied data.
*
* \param user_data will be passed as the user_data argument when pfn_notify
* is called. user_data can be NULL.
*
* \return CL_SUCCESS if successfull otherwise one of the following
* error values:
*
* - CL_INVALID_EVENT if event is not a valid event object or is a user
* event object created using clCreateUserEvent.
* - CL_INVALID_VALUE if pfn_event_notify is NULL or if
* command_exec_callback_type is not a valid command execution status.
*
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the OpenCL implementation on the host.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int setCallback(
cl_int type,
void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
void * user_data = NULL)
{
return detail::errHandler(
::clSetEventCallback(
object_,
type,
pfn_notify,
user_data),
__SET_EVENT_CALLBACK_ERR);
}
#endif
/*! \brief Wait on the host thread for commands identified by event objects in
* event_list to complete.
*
......@@ -2029,6 +2127,95 @@ public:
}
};
#if defined(CL_VERSION_1_1)
/*! \class UserEvent
* \brief User event interface for cl_event.
*/
class UserEvent : public Event
{
public:
/*! \brief Create a user event object.
*
* \param context is a valid OpenCL context used to create the event object.
*
* \param err will return an appropriate error code.
* If \a err is NULL, no error code is returned.
*
* \return A valid non-zero buffer object and \a err is set to
* CL_SUCCESS if the buffer object is created successfully or a NULL value
* with one of the following error values returned in \a err:
* - CL_INVALID_CONTEXT if \a context is not a valid context.
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the runtime.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
UserEvent(
const Context& context,
cl_int * err = NULL)
{
cl_int error;
object_ = ::clCreateUserEvent(
context(),
&error);
detail::errHandler(error, __CREATE_USER_EVENT_ERR);
if (err != NULL) {
*err = error;
}
}
//! Default constructor; buffer is not valid at this point.
UserEvent() : Event() { }
/*!
* \brief Construct a new user event from a valid user event.
*
* \param event The event object used for creation.
*/
UserEvent(const UserEvent& event) : Event(event) { }
/*!
* \brief Assign a user event.
*
* \param rhs the user event object on rhs of the assignment.
*/
UserEvent& operator = (const UserEvent& rhs)
{
if (this != &rhs) {
Event::operator=(rhs);
}
return *this;
}
/*!
* \brief Set the execution status.
*
* \param status specifies the new execution status to be set
* and can be CL_COMPLETE or a negative integer value to indicate an error.
*
* \return CL_SUCCESS if the status is updated successfully or
* one of the following error values:
* - CL_INVALID_VALUE if the execution_status is not CL_COMPLETE or a
* negative integer value.
* - CL_INVALID_OPERATION if the execution_status for event has already
* been changed by a previous call to setStatus.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int setStatus(cl_int status)
{
return detail::errHandler(
::clSetUserEventStatus(object_,status),
__SET_USER_EVENT_STATUS_ERR);
}
};
#endif
/*! \brief Wait on the host thread for commands identified by event objects in
* event_list to complete.
*
......@@ -2139,6 +2326,48 @@ public:
}
return param;
}
#if defined(CL_VERSION_1_1)
/*!
* \brief Register a destructor callback function.
*
* \param pfn_event_notify is the event callback function that can be
* registered by the application. This callback function may be called
* asynchronously by the OpenCL implementation. It is the application�s
* responsibility to ensure that the callback function is thread-safe.
* The parameters to this callback function are:
*
* - memobj is the memory object being deleted.
* - user_data is a pointer to user supplied data.
*
* \param user_data will be passed as the user_data argument when pfn_notify
* is called. user_data can be NULL.
*
* \return CL_SUCCESS if successfull otherwise one of the following
* error values:
*
* - CL_INVALID_MEM_OBJECT if memobj is not a valid memory object.
*
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the OpenCL implementation on the host.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int setDestructorCallback(
void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
void * user_data = NULL)
{
return detail::errHandler(
::clSetMemObjectDestructorCallback(
object_,
pfn_notify,
user_data),
__SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
}
#endif
};
/*! \class Buffer
......@@ -2227,6 +2456,55 @@ public:
}
return *this;
}
#if defined(CL_VERSION_1_1)
/*!
* \brief Create a new buffer object from current.
*
* \param flags is a bit-field that is used to specify allocation
* and usage information about the buffer memory object being created.
*
* \param buffer_create_type describes the type of buffer object to be
* created.
*
* \param buffer_create_info is the buffer descriptor.
*
* \param err is A valid non-zero buffer object and \a err is set to
* CL_SUCCESS if the buffer object is created successfully or a NULL value
* with one of the following error values returned in \a err:
* - CL_INVALID_VALUE if values specified in \a flags are not valid.
* - CL_INVALID_VALUE if value specified in \a buffer_create_type is not valid.
* - CL_INVALID_VALUE if value(s) specified in \a buffer_create_info
* (for a given \a buffer_create_type) is not a valid or if
* \a buffer_create_type is NULL.
*
* \return Buffer object, if the creation fails then the object is not valid.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
Buffer createSubBuffer(
cl_mem_flags flags,
cl_buffer_create_type buffer_create_type,
const void * buffer_create_info,
cl_int * err = NULL)
{
Buffer result;
cl_int error;
result.object_ = ::clCreateSubBuffer(
object_,
flags,
buffer_create_type,
buffer_create_info,
&error);
detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
if (err != NULL) {
*err = error;
}
}
#endif
};
#if defined (USE_DX_INTEROP)
......@@ -4295,6 +4573,373 @@ public:
__ENQEUE_COPY_BUFFER_ERR);
}
#if defined(CL_VERSION_1_1)
/*! \brief Enqueue a command to read a 2D or 3D rectangular region from
* a buffer object to host memory.
*
* \param buffer refers to a valid buffer object.
*
* \param blocking indicates if the write operation is blocking or
* non-blocking. If \a blocking is CL_TRUE, the OpenCL implementation
* copies the data referred to by \a ptr and enqueues the write operation
* in the command-queue. The memory pointed to by \a ptr can be reused
* by the application after the enqueueReadBufferRect call returns. If
* \a blocking is CL_FALSE, the OpenCL implementation will use \a ptr to
* perform a nonblocking write. As the write is non-blocking the
* implementation can return immediately. The memory pointed to by \a ptr
* cannot be reused by the application after the call returns.
* The \a event argument returns an event object which can be used to
* query the execution status of the write command. When the write
* command has completed, the memory pointed to by \a ptr can then be
* reused by the application
*
* \param buffer_origin defines the (x, y, z) offset in the memory region
* associated with buffer. For a 2D rectangle region, the z value given
* by buffer_origin[2] should be 0. The offset in bytes is computed as
* buffer_origin[2] * buffer_slice_pitch + buffer_origin[1] * buffer_row_pitch
* + buffer_origin[0].
*
* \param host_origin defines the (x, y, z) offset in the memory region
* pointed to by ptr. For a 2D rectangle region, the z value given by
* host_origin[2] should be 0. The offset in bytes is computed as
* host_origin[2] * host_slice_pitch + host_origin[1] * host_row_pitch +
* host_origin[0].
*
* \param region defines the (width, height, depth) in bytes of the 2D or
* 3D rectangle being read or written. For a 2D rectangle copy, the depth
* value given by region[2] should be 1.
*
* \param buffer_row_pitch is the length of each row in bytes to be used
* for the memory region associated with buffer. If buffer_row_pitch is 0,
* buffer_row_pitch is computed as region[0].
*
* \param buffer_slice_pitch is the length of each 2D slice in bytes to be
* used for the memory region associated with buffer. If buffer_slice_pitch
* is 0, buffer_slice_pitch is computed as region[1] * buffer_row_pitch.
*
* \param host_row_pitch is the length of each row in bytes to be used for
* the memory region pointed to by ptr. If host_row_pitch is 0, host_row_pitch
* is computed as region[0].
*
* \param host_slice_pitch is the length of each 2D slice in bytes to be
* used for the memory region pointed to by ptr. If host_slice_pitch is 0,
* host_slice_pitch is computed as region[1] * host_row_pitch.
*
* \param events specifies events that need to complete before this
* particular command can be executed. If \a events is NULL, its default,
* then this particular command does not wait on any event to complete.
* The events specified in \a event_wait_list act as synchronization
* points.
*
* \param event returns an event object that identifies this particular
* write command and can be used to query or queue a wait for this
* particular command to complete. \a event can be NULL in which case it
* will not be possible for the application to query the status of this
* command or queue a wait for this command to complete.
*
* \return CL_SUCCESS if the function is executed successfully. Otherwise
* it returns one of the following errors:
* - CL_INVALID_CONTEXT if the context associated with command_queue and
* buffer are not the same or if the context associated with command_queue
* and events in event_wait_list are not the same.
*
* - CL_INVALID_MEM_OBJECT if buffer is not a valid buffer object.
*
* - CL_INVALID_VALUE if the region being read or written specified by
* (buffer_offset,region) is out of bounds.
*
* - CL_INVALID_VALUE if ptr is a NULL value.
*
* - CL_MISALIGNED_SUB_BUFFER_OFFSET if buffer is a sub-buffer object and
* offset specified when the sub-buffer object is created is not aligned to
* CL_DEVICE_MEM_BASE_ADDR_ALIGN value for device associated with queue.
*
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory
* for data store associated with buffer.
*
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the OpenCL implementation on the host.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int enqueueReadBufferRect(
const Buffer& buffer,
cl_bool blocking,
const size_t<3>& buffer_offset,
const size_t<3>& host_offset,
const size_t<3>& region,
::size_t buffer_row_pitch,
::size_t buffer_slice_pitch,
::size_t host_row_pitch,
::size_t host_slice_pitch,
void *ptr,
const VECTOR_CLASS<Event>* events = NULL,
Event* event = NULL) const
{
return detail::errHandler(
::clEnqueueReadBufferRect(
object_,
buffer(),
blocking,
(const ::size_t *)buffer_offset,
(const ::size_t *)host_offset,
(const ::size_t *)region,
buffer_row_pitch,
buffer_slice_pitch,
host_row_pitch,
host_slice_pitch,
ptr,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(cl_event*) event),
__ENQUEUE_READ_BUFFER_RECT_ERR);
}
/*! \brief Enqueue a command to write a 2D or 3D rectangular region from
* host memory to a buffer object.
*
* \param buffer refers to a valid buffer object.
*
* \param blocking indicates if the write operation is blocking or
* non-blocking. If \a blocking is CL_TRUE, the OpenCL implementation
* copies the data referred to by \a ptr and enqueues the write operation
* in the command-queue. The memory pointed to by \a ptr can be reused
* by the application after the enqueueWriteBufferRect call returns. If
* \a blocking is CL_FALSE, the OpenCL implementation will use \a ptr to
* perform a nonblocking write. As the write is non-blocking the
* implementation can return immediately. The memory pointed to by \a ptr
* cannot be reused by the application after the call returns.
* The \a event argument returns an event object which can be used to
* query the execution status of the write command. When the write
* command has completed, the memory pointed to by \a ptr can then be
* reused by the application
*
* \param buffer_origin defines the (x, y, z) offset in the memory region
* associated with buffer. For a 2D rectangle region, the z value given
* by buffer_origin[2] should be 0. The offset in bytes is computed as
* buffer_origin[2] * buffer_slice_pitch + buffer_origin[1] * buffer_row_pitch
* + buffer_origin[0].
*
* \param host_origin defines the (x, y, z) offset in the memory region
* pointed to by ptr. For a 2D rectangle region, the z value given by
* host_origin[2] should be 0. The offset in bytes is computed as
* host_origin[2] * host_slice_pitch + host_origin[1] * host_row_pitch +
* host_origin[0].
*
* \param region defines the (width, height, depth) in bytes of the 2D or
* 3D rectangle being read or written. For a 2D rectangle copy, the depth
* value given by region[2] should be 1.
*
* \param buffer_row_pitch is the length of each row in bytes to be used
* for the memory region associated with buffer. If buffer_row_pitch is 0,
* buffer_row_pitch is computed as region[0].
*
* \param buffer_slice_pitch is the length of each 2D slice in bytes to be
* used for the memory region associated with buffer. If buffer_slice_pitch
* is 0, buffer_slice_pitch is computed as region[1] * buffer_row_pitch.
*
* \param host_row_pitch is the length of each row in bytes to be used for
* the memory region pointed to by ptr. If host_row_pitch is 0, host_row_pitch
* is computed as region[0].
*
* \param host_slice_pitch is the length of each 2D slice in bytes to be
* used for the memory region pointed to by ptr. If host_slice_pitch is 0,
* host_slice_pitch is computed as region[1] * host_row_pitch.
*
* \param events specifies events that need to complete before this
* particular command can be executed. If \a events is NULL, its default,
* then this particular command does not wait on any event to complete.
* The events specified in \a event_wait_list act as synchronization
* points.
*
* \param event returns an event object that identifies this particular
* write command and can be used to query or queue a wait for this
* particular command to complete. \a event can be NULL in which case it
* will not be possible for the application to query the status of this
* command or queue a wait for this command to complete.
*
* \return CL_SUCCESS if the function is executed successfully. Otherwise
* it returns one of the following errors:
* - CL_INVALID_CONTEXT if the context associated with command_queue and
* buffer are not the same or if the context associated with command_queue
* and events in event_wait_list are not the same.
*
* - CL_INVALID_MEM_OBJECT if buffer is not a valid buffer object.
*
* - CL_INVALID_VALUE if the region being read or written specified by
* (buffer_offset,region) is out of bounds.
*
* - CL_INVALID_VALUE if ptr is a NULL value.
*
* - CL_MISALIGNED_SUB_BUFFER_OFFSET if buffer is a sub-buffer object and
* offset specified when the sub-buffer object is created is not aligned to
* CL_DEVICE_MEM_BASE_ADDR_ALIGN value for device associated with queue.
*
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory
* for data store associated with buffer.
*
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the OpenCL implementation on the host.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int enqueueWriteBufferRect(
const Buffer& buffer,
cl_bool blocking,
const size_t<3>& buffer_offset,
const size_t<3>& host_offset,
const size_t<3>& region,
::size_t buffer_row_pitch,
::size_t buffer_slice_pitch,
::size_t host_row_pitch,
::size_t host_slice_pitch,
const void *ptr,
const VECTOR_CLASS<Event>* events = NULL,
Event* event = NULL) const
{
return detail::errHandler(
::clEnqueueWriteBufferRect(
object_,
buffer(),
blocking,
(const ::size_t *)buffer_offset,
(const ::size_t *)host_offset,
(const ::size_t *)region,
buffer_row_pitch,
buffer_slice_pitch,
host_row_pitch,
host_slice_pitch,
ptr,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(cl_event*) event),
__ENQUEUE_WRITE_BUFFER_RECT_ERR);
}
/*! \brief Enqueues a command to copy a 2D or 3D rectangular region from
* a buffer object to a 2D or 3D region of another.
*
* \param src is the source buffer object.
*
* \param dst is the destination buffer object.
*
* \param src_origin defines the (x, y, z) offset in the memory region
* associated with src_buffer. For a 2D rectangle region, the z value
* given by src_origin[2] should be 0. The offset in bytes is computed as
* src_origin[2] * src_slice_pitch + src_origin[1] *
* src_row_pitch + src_origin[0].
*
* \param dst_origin dst_origin defines the (x, y, z) offset in the memory
* region associated with dst_buffer. For a 2D rectangle region, the z
* value given by dst_origin[2] should be 0. The offset in bytes is
* computed as dst_origin[2] * dst_slice_pitch + dst_origin[1] *
* dst_row_pitch + dst_origin[0].
*
* \param region defines the (width, height, depth) in bytes of the 2D or
* 3D rectangle being copied. For a 2D rectangle, the depth value
* given by region[2] should be 1.
*
* \param src_row_pitch is the length of each row in bytes to be used for
* the memory region associated with src_buffer. If src_row_pitch is 0,
* src_row_pitch is computed as region[0].
*
* \param src_slice_pitch is the length of each 2D slice in bytes to be used
* for the memory region associated with src_buffer. If src_slice_pitch is 0,
* src_slice_pitch is computed as region[1] * src_row_pitch.
*
* \param dst_row_pitch is the length of each row in bytes to be used for the memory
* region associated with dst_buffer. If dst_row_pitch is 0, dst_row_pitch
* is computed as region[0].
*
* \param dst_slice_pitch is the length of each 2D slice in bytes to be used
* for the memory region associated with dst_buffer. If dst_slice_pitch is 0,
* dst_slice_pitch is computed as region[1] * dst_row_pitch.
*
* \param events specifies events that need to complete before this
* particular command can be executed. If \a events is NULL,
* then this particular command does not wait on any event to complete.
* The events specified in \a event_wait_list act as synchronization
* points.
*
* \param event returns an event object that identifies this particular
* copy command and can be used to query or queue a wait for this
* particular command to complete. \a event can be NULL in which case it
* will not be possible for the application to query the status of this
* command or queue and wait for this command to complete. enqueueBarrier
* can be used instead.
*
* \return CL_SUCCESS if the function is executed successfully. Otherwise
* it returns one of the following errors:
* - CL_INVALID_CONTEXT if the context associated with command_queue,
* src_buffer and dst_buffer are not the same or if the context
* associated with command_queue and events in \a events are not the same.
*
* - CL_INVALID_MEM_OBJECT if src_buffer and dst_buffer are not valid
* buffer objects.
*
* - CL_INVALID_VALUE if (src_offset, region) or (dst_offset, region)
* require accessing elements outside the src_buffer and dst_buffer
* buffer objects respectively.
*
* - CL_MEM_COPY_OVERLAP if src_buffer and dst_buffer are the same buffer
* object and the source and destination regions overlap.
*
* - CL_MISALIGNED_SUB_BUFFER_OFFSET if src_buffer is a sub-buffer object and
* offset specified when the sub-buffer object is created is not aligned to
*
* - CL_DEVICE_MEM_BASE_ADDR_ALIGN value for device associated with queue.
*
* - CL_MISALIGNED_SUB_BUFFER_OFFSET if dst_buffer is a sub-buffer object
* and offset specified when the sub-buffer object is created is not
* aligned to CL_DEVICE_MEM_BASE_ADDR_ALIGN value for device associated
* with queue.
*
* - CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate
* memory for data store associated with src_buffer or dst_buffer.
*
* - CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources
* required by the OpenCL implementation on the host.
*
* \note In the case that exceptions are enabled and error value
* other than CL_SUCCESS is generated, then cl::Error exception is
* generated.
*/
cl_int enqueueCopyBufferRect(
const Buffer& src,
const Buffer& dst,
const size_t<3>& src_origin,
const size_t<3>& dst_origin,
const size_t<3>& region,
::size_t src_row_pitch,
::size_t src_slice_pitch,
::size_t dst_row_pitch,
::size_t dst_slice_pitch,
const VECTOR_CLASS<Event>* events = NULL,
Event* event = NULL) const
{
return detail::errHandler(
::clEnqueueCopyBufferRect(
object_,
src(),
dst(),
(const ::size_t *)src_origin,
(const ::size_t *)dst_origin,
(const ::size_t *)region,
src_row_pitch,
src_slice_pitch,
dst_row_pitch,
dst_slice_pitch,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(cl_event*) event),
__ENQEUE_COPY_BUFFER_RECT_ERR);
}
#endif
/*! \brief Enqueue a command to read from a 2D or 3D image object to host
* memory
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment