OpenCL™规范 5.3.4. 读、写和复制图像对象

5.3.4. Reading, Writing and Copying Image Objects
5.3.4. 读、写和复制图像对象

The following functions enqueue commands to read from an image or image array object to host memory or write to an image or image array object from host memory.

以下函数将从图像或图像阵列对象读取到主存储器或从主存储器写入图像或图像数组对象的命令排队。

// Provided by CL_VERSION_1_0
cl_int clEnqueueReadImage(
    cl_command_queue command_queue,
    cl_mem image,
    cl_bool blocking_read,
    const size_t* origin,
    const size_t* region,
    size_t row_pitch,
    size_t slice_pitch,
    void* ptr,
    cl_uint num_events_in_wait_list,
    const cl_event* event_wait_list,
    cl_event* event);
// Provided by CL_VERSION_1_0
cl_int clEnqueueWriteImage(
    cl_command_queue command_queue,
    cl_mem image,
    cl_bool blocking_write,
    const size_t* origin,
    const size_t* region,
    size_t input_row_pitch,
    size_t input_slice_pitch,
    const void* ptr,
    cl_uint num_events_in_wait_list,
    const cl_event* event_wait_list,
    cl_event* event);
  • command_queue refers to the host command-queue in which the read / write command will be queued. command_queue and image must be created with the same OpenCL context.

  • command_queue是指读/写命令将在其中排队的主机命令队列。command_queue和image必须使用相同的OpenCL上下文创建。

  • image refers to a valid image or image array object.

  • image是指有效的图像或图像阵列对象。

  • blocking_read and blocking_write indicate if the read and write operations are blocking or non-blocking.

  • blocking_ read和blocking_write指示读取和写入操作是阻塞还是非阻塞。

  • origin defines the (xyz) offset in pixels in the 1D, 2D or 3D image, the (xy) offset and the image index in the 2D image array or the (x) offset and the image index in the 1D image array. If image is a 2D image object, origin[2] must be 0. If image is a 1D image or 1D image buffer object, origin[1] and origin[2] must be 0. If image is a 1D image array object, origin[2] must be 0. If image is a 1D image array object, origin[1] describes the image index in the 1D image array. If image is a 2D image array object, origin[2] describes the image index in the 2D image array.

  • origin定义1D、2D或3D图像中以像素为单位的(x,y,z)偏移、2D图像阵列中的(x、y)偏移和图像索引或1D图像阵列中(x)偏移和图象索引。如果图像是2D图像对象,则origin[2]必须为0。如果图像是1D图像或1D图像缓冲区对象,则origin[1]和origin[2]必须为0。如果图像是1D图像阵列对象,则origin[2]必须为0。如果图像是1D图像阵列对象,origin[1]描述1D图像数组中的图像索引。如果图像是2D图像阵列对象,origin[2]描述2D图像阵列中的图像索引。

  • region defines the (widthheightdepth) in pixels of the 1D, 2D or 3D rectangle, the (widthheight) in pixels of the 2D rectangle and the number of images of a 2D image array or the (width) in pixels of the 1D rectangle and the number of images of a 1D image array. If image is a 2D image object, region[2] must be 1. If image is a 1D image or 1D image buffer object, region[1] and region[2] must be 1. If image is a 1D image array object, region[2] must be 1. The values in region cannot be 0. If image is a mipmapped image, the mip level to read or write is determined from origin as described in Specifying Mipmap Levels to Image Operations

  • region定义1D、2D或3D矩形的(宽度、高度、深度)(以像素为单位)、2D矩形的(宽、高)和2D图像阵列的图像数量或1D矩形的(高)和1D图像阵列的(宽)和图像数量。如果图像是2D图像对象,则region[2]必须为1。如果图像是1D图像或1D图像缓冲对象,则region[1]和region[2]必须为1。如果图像是1D图像阵列对象,则region[2]必须为1。区域中的值不能为0。如果图像是Mipmap图像,则要读取或写入的mip级别是从原点确定的,如“为图像操作指定Mipmap级别”中所述

  • row_pitch in clEnqueueReadImage and input_row_pitch in clEnqueueWriteImage is the length of each row in bytes. This value must be greater than or equal to the element size in bytes × width. If row_pitch (or input_row_pitch) is set to 0, the appropriate row pitch is calculated based on the size of each element in bytes multiplied by width.

  • ​clEnqueueReadImage中的row_pitch和clEnqueueWriteImage中的input_row_pitch是每行的长度(以字节为单位)。此值必须大于或等于元素大小(字节×宽度)。如果row_pitch(或input_row_pitch)设置为0,则根据每个元素的大小(以字节为单位)乘以宽度来计算适当的行间距。

  • slice_pitch in clEnqueueReadImage and input_slice_pitch in clEnqueueWriteImage is the size in bytes of the 2D slice of the 3D region of a 3D image or each image of a 1D or 2D image array being read or written respectively. This must be 0 if image is a 1D or 2D image. Otherwise this value must be greater than or equal to row_pitch × height. If slice_pitch (or input_slice_pitch) is set to 0, the appropriate slice pitch is calculated based on the row_pitch × height.

  • ​clEnqueueReadImage中的slice_pitch和clEnqueueWriteImage中的input_slice_pitch是分别被读取或写入的3D图像或1D或2D图像阵列的每个图像的3D区域的2D切片的以字节为单位的大小。如果图像是1D或2D图像,则此值必须为0。否则,该值必须大于或等于row_pitch×height。如果slice_ppitch(或input_slice_pitch)设置为0,则会根据row_pitch×height计算适当的切片间距。

  • ptr is the pointer to a buffer in host memory where image data is to be read from or to be written to. The alignment requirements for ptr are specified in Alignment of Application Data Types.

  • ​ptr是指向主机内存中要读取或写入图像数据的缓冲区的指针。ptr的对齐要求在应用程序数据类型的对齐中指定。

  • event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. If event_wait_list is NULLnum_events_in_wait_list must be 0. If event_wait_list is not NULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_queue must be the same. The memory associated with event_wait_list can be reused or freed after the function returns.

  • event_wait_list和num_events_in_wait_list指定在执行此特定命令之前需要完成的事件。如果event_wait_list为NULL,则此特定命令不等待任何事件完成。如果event_wait_list为NULL,则num_events_in_wait_list必须为0。如果event_wait_list不为NULL,则event_wail_list指向的事件列表必须有效,并且num_events_in_wait_list必须大于0。event_wait_list中指定的事件充当同步点。与event_wait_list和command_queue中的事件关联的上下文必须相同。函数返回后,可以重用或释放与event_wait_list关联的内存。

  • event returns an event object that identifies this read / write command and can be used to query or queue a wait for this command to complete. If event is NULL or the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not NULLevent must not refer to an element of the event_wait_list array.

  • event返回一个事件对象,该对象标识此读/写命令,可用于查询或排队等待此命令完成。如果事件为NULL或排队不成功,则不会创建任何事件,因此无法查询此命令的状态或等待此命令完成。如果event_wait_list和event不为NULL,则event不能引用event_wail_list数组的元素。

If blocking_read is CL_TRUE i.e. the read command is blocking, clEnqueueReadImage does not return until the buffer data has been read and copied into memory pointed to by ptr.

​如果blocking_read为CL_TRUE,即读取命令为blocking,则clEnqueueReadImage不会返回,直到缓冲区数据已被读取并复制到ptr指向的内存中。

If blocking_read is CL_FALSE i.e. the read command is non-blocking, clEnqueueReadImage queues a non-blocking read command and returns. The contents of the buffer that ptr points to cannot be used until the read command has completed. The event argument returns an event object which can be used to query the execution status of the read command. When the read command has completed, the contents of the buffer that ptr points to can be used by the application.

​如果blocking_read为CL_FALSE,即读取命令为非阻塞,则clEnqueueReadImage将非阻塞读取命令排队并返回。ptr指向的缓冲区的内容在读取命令完成之前无法使用。事件参数返回一个事件对象,该对象可用于查询读取命令的执行状态。读取命令完成后,ptr所指向的缓冲区的内容可以由应用程序使用。

If blocking_write is CL_TRUE, the write command is blocking and does not return until the command is complete, including transfer of the data. The memory pointed to by ptr can be reused by the application after the clEnqueueWriteImage call returns.

​如果blocking_write为CL_TRUE,则写入命令处于阻塞状态,并且在命令完成(包括数据传输)之前不会返回。在clEnqueueWriteImage调用返回后,ptr指向的内存可以被应用程序重用。

If blocking_write is CL_FALSE, the OpenCL implementation will use ptr to perform a non-blocking write. As the write is non-blocking the implementation can return immediately. The memory pointed to by ptr cannot be reused by the application after the call returns. The 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 ptr can then be reused by the application.

​如果blocking_write为CL_FALSE,则OpenCL实现将使用ptr执行非阻塞写入。由于写入是非阻塞的,因此实现可以立即返回。ptr指向的内存在调用返回后无法被应用程序重用。事件参数返回一个事件对象,该对象可用于查询写入命令的执行状态。当写命令完成后,ptr指向的内存就可以被应用程序重用。

clEnqueueReadImage and clEnqueueWriteImage return CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

如果函数执行成功,clEnqueueReadImage和clEnqueueWriteImage将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是有效的主机命令队列)。

  • CL_INVALID_CONTEXT if the context associated with command_queue and image are not the same or if the context associated with command_queue and events in event_wait_list are not the same.

  • 如果与command_queue和image相关联的上下文不相同,或者与command_ queue和event_wait_list中的事件相关联的语境不相同,则CL_INVALID_CONTEXT。

  • CL_INVALID_MEM_OBJECT if image is not a valid image object.

  • CL_INVALID_MEM_OBJECT(如果图像不是有效的图像对象)。

  • CL_INVALID_VALUE if origin or region is NULL.

  • CL_INVALID_VALUE(如果原点或区域为NULL)。

  • CL_INVALID_VALUE if the region being read or written specified by origin and region is out of bounds.

  • CL_INVALID_VALUE,如果由原点和区域指定的正在读取或写入的区域越界。

  • CL_INVALID_VALUE if values in origin and region do not follow rules described in the argument description for origin and region.

  • CL_INVALID_VALUE,如果原点和区域中的值不遵循原点和区域的参数描述中描述的规则。

  • CL_INVALID_VALUE if image is a 1D or 2D image and slice_pitch or input_slice_pitch is not 0.

  • CL_INVALID_VALUE,如果图像是1D或2D图像并且slice_pitch或input_slice_pitch不为0。

  • CL_INVALID_VALUE if ptr is NULL.

  • CL_INVALID_VALUE(如果ptr为NULL)。

  • CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.

  • CL_INVALID_EVENT_WAIT_LIST如果event_wait_list为NULL且num_events_in_wait_list>0,或者event_wait_list不为NULL且num_events_in_wait_list为0,或者如果event_wait_list中的事件对象不是有效事件。

  • CL_INVALID_IMAGE_SIZE if image dimensions (image width, height, specified or compute row and/or slice pitch) for image are not supported by device associated with queue.

  • CL_INVALID_IMAGE_SIZE如果与队列相关联的设备不支持图像的图像尺寸(图像宽度、高度、指定或计算行或切片间距)。

  • CL_IMAGE_FORMAT_NOT_SUPPORTED if image format (image channel order and data type) for image are not supported by device associated with queue.

  • 如果与队列关联的设备不支持图像的图像格式(图像通道顺序和数据类型),则CL_IMAGE_FORMAT_NOT_SUPPORTED。

  • CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for data store associated with image.

  • CL_MEM_OBJECT_ALLOCATION_FAILURE(如果为与图像相关的数据存储分配内存失败)。

  • CL_INVALID_OPERATION if the device associated with command_queue does not support images (i.e. CL_DEVICE_IMAGE_SUPPORT specified in the Device Queries table is CL_FALSE).

  • CL_INVALID_OPERATION,如果与command_queue关联的设备不支持映像(即,在设备查询表中指定的CL_DEVICE_IMAGE_SUPPORT为CL_FALSE)。

  • CL_INVALID_OPERATION if clEnqueueReadImage is called on image which has been created with CL_MEM_HOST_WRITE_ONLY or CL_MEM_HOST_NO_ACCESS.

  • CL_INVALID_OPERATION如果对使用CL_MEM_HOST_WRITE_ONLY或CL_MEM_HOST_NO_ACCESS创建的映像调用clEnqueueReadImage。

  • CL_INVALID_OPERATION if clEnqueueWriteImage is called on image which has been created with CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_NO_ACCESS.

  • CL_INVALID_OPERATION如果对使用CL_MEM_HOST_READ_ONLY或CL_MEM_HOST_NO_ACCESS创建的映像调用clEnqueueWriteImage。

  • CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST if the read and write operations are blocking and the execution status of any of the events in event_wait_list is a negative integer value. This error code is missing before version 1.1.

  • CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST,如果读取和写入操作是阻塞的,并且event_wait_list中任何事件的执行状态是负整数值。1.1版本之前缺少此错误代码。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

  • CL_INVALID_MIP_LEVEL if the cl_khr_mipmap_image extension is supported, and the mip level specified in origin is not a valid level for image,

  • CL_INVALID_MIP_LEVEL如果支持CL_khr_mipmap_image扩展,并且在origin中指定的MIP级别不是图像的有效级别,

Calling clEnqueueReadImage to read a region of the image with the ptr argument value set to host_ptr + (origin[2] × image slice pitch + origin[1] × image row pitch + origin[0] × bytes per pixel), where host_ptr is a pointer to the memory region specified when the image being read is created with CL_MEM_USE_HOST_PTR, must meet the following requirements in order to avoid undefined behavior:

调用clEnqueueReadImage读取ptr参数值设置为host_ptr+(origin[2]×图像切片间距+origin[1]×图像行间距+origin[0]×字节/像素)的图像区域,其中host_ptr是在使用CL_MEM_USE_HOST_PTR创建要读取的图像时指定的内存区域的指针,必须满足以下要求,以避免未定义的行为:

  • All commands that use this image object have finished execution before the read command begins execution.

  • 在读取命令开始执行之前,使用此图像对象的所有命令都已完成执行。

  • The row_pitch and slice_pitch argument values in clEnqueueReadImage must be set to the image row pitch and slice pitch.

  • ​clEnqueueReadImage中的row_pitch和slice_pitch参数值必须设置为图像的行间距和切片间距。

  • The image object is not mapped.

  • 图像对象未映射。

  • The image object is not used by any command-queue until the read command has finished execution.

  • 在读取命令完成执行之前,任何命令队列都不会使用图像对象。

Calling clEnqueueWriteImage to update the latest bits in a region of the image with the ptr argument value set to host_ptr + (origin[2] × image slice pitch + origin[1] × image row pitch + origin[0] × bytes per pixel), where host_ptr is a pointer to the memory region specified when the image being written is created with CL_MEM_USE_HOST_PTR, must meet the following requirements in order to avoid undefined behavior:


调用clEnqueueWriteImage以更新ptr参数值设置为host_ptr+(origin[2]×image slice pitch+origin[1]×image row pitch+origin[0]×bytes per pixel)的图像区域中的最新位,其中host_ptr是使用CL_MEM_USE_host_ptr创建正在写入的图像时指定的内存区域的指针,必须满足以下要求,以避免未定义的行为:

  • The host memory region being written contains the latest bits when the enqueued write command begins execution.

  • 当排队写入命令开始执行时,正在写入的主机存储器区域包含最新的位。

  • The input_row_pitch and input_slice_pitch argument values in clEnqueueWriteImage must be set to the image row pitch and slice pitch.

  • ​clEnqueueWriteImage中的input_row_pitch和input_slice_pitch参数值必须设置为图像行间距和切片间距。

  • The image object is not mapped.

  • 图像对象未映射。

  • The image object is not used by any command-queue until the write command has finished execution.

  • 在写入命令完成执行之前,任何命令队列都不会使用图像对象。

To enqueue a command to copy image objects, call the function

要将复制图像对象的命令排入队列,请调用函数

// Provided by CL_VERSION_1_0
cl_int clEnqueueCopyImage(
    cl_command_queue command_queue,
    cl_mem src_image,
    cl_mem dst_image,
    const size_t* src_origin,
    const size_t* dst_origin,
    const size_t* region,
    cl_uint num_events_in_wait_list,
    const cl_event* event_wait_list,
    cl_event* event);
  • src_image and dst_image can be 1D, 2D, 3D image or a 1D, 2D image array objects. It is possible to copy subregions between any combinations of source and destination types, provided that the dimensions of the subregions are the same e.g., one can copy a rectangular region from a 2D image to a slice of a 3D image.

  • src_image和dst_image可以是1D、2D、3D图像或1D、二维图像阵列对象。可以在源类型和目的地类型的任何组合之间复制子区域,前提是子区域的尺寸相同,例如,可以将矩形区域从2D图像复制到3D图像的切片。

  • command_queue refers to the host command-queue in which the copy command will be queued. The OpenCL context associated with command_queuesrc_image and dst_image must be the same.

  • command_queue是指复制命令将在其中排队的主机命令队列。与command_queue、src_image和dst_image关联的OpenCL上下文必须相同。

  • src_origin defines the (xyz) offset in pixels in the 1D, 2D or 3D image, the (xy) offset and the image index in the 2D image array or the (x) offset and the image index in the 1D image array. If image is a 2D image object, src_origin[2] must be 0. If src_image is a 1D image object, src_origin[1] and src_origin[2] must be 0. If src_image is a 1D image array object, src_origin[2] must be 0. If src_image is a 1D image array object, src_origin[1] describes the image index in the 1D image array. If src_image is a 2D image array object, src_origin[2] describes the image index in the 2D image array. If src_image is a mipmapped image, the mip level to read is determined from src_origin as described in Specifying Mipmap Levels to Image Operations

  • ​src_origin定义1D、2D或3D图像中以像素为单位的(x,y,z)偏移量、2D图像阵列中的(x、y)偏移量和图像索引或1D图像阵列中(x)偏移量与图像索引。如果图像是2D图像对象,则src_origin[2]必须为0。如果src_image是1D图像对象,则src_origin[1]和src_origin[2]必须为0。如果src_image是1D图像数组对象,则src_origin[2]必须为0。如果src_image是1D图像阵列对象,则src_origin[1]描述1D图像数组中的图像索引。如果src_image是2D图像阵列对象,则src_origin[2]描述2D图像阵列中的图像索引。如果src_image是Mipmap映像,则要读取的mip级别是根据src_origin确定的,如“为映像操作指定Mipmap级别”中所述

  • dst_origin defines the (xyz) offset in pixels in the 1D, 2D or 3D image, the (xy) offset and the image index in the 2D image array or the (x) offset and the image index in the 1D image array. If dst_image is a 2D image object, dst_origin[2] must be 0. If dst_image is a 1D image or 1D image buffer object, dst_origin[1] and dst_origin[2] must be 0. If dst_image is a 1D image array object, dst_origin[2] must be 0. If dst_image is a 1D image array object, dst_origin[1] describes the image index in the 1D image array. If dst_image is a 2D image array object, dst_origin[2] describes the image index in the 2D image array. If dst_image is a mipmapped image, the mip level to write is determined from dst_origin as described in Specifying Mipmap Levels to Image Operations

  • ​dst_origin定义1D、2D或3D图像中以像素为单位的(x,y,z)偏移、2D图像阵列中的(x、y)偏移和图像索引或1D图像阵列中(x)偏移和图象索引。如果dst_image是2D图像对象,则dst_origin[2]必须为0。如果dst_image是1D图像或1D图像缓冲区对象,则dst_origin[1]和dst_origin[2]必须为0。如果dst_image是1D图像数组对象,则dst_origin[2]必须为0。如果dst_image是1D图像阵列对象,则dst_origin[1]描述1D图像数组中的图像索引。如果dst_image是2D图像阵列对象,则dst_origin[2]描述2D图像阵列中的图像索引。如果dst_image是Mipmap映像,则要写入的mip级别由dst_origin确定,如“为映像操作指定Mipmap级别”中所述

  • region defines the (widthheightdepth) in pixels of the 1D, 2D or 3D rectangle, the (widthheight) in pixels of the 2D rectangle and the number of images of a 2D image array or the (width) in pixels of the 1D rectangle and the number of images of a 1D image array. If src_image or dst_image is a 2D image object, region[2] must be 1. If src_image or dst_image is a 1D image or 1D image buffer object, region[1] and region[2] must be 1. If src_image or dst_image is a 1D image array object, region[2] must be 1. The values in region cannot be 0.

  • region定义1D、2D或3D矩形的(宽度、高度、深度)(以像素为单位)、2D矩形的(宽、高)和2D图像阵列的图像数量或1D矩形的(高)和1D图像阵列的(宽)和图像数量。如果src_image或dst_image是2D图像对象,则region[2]必须为1。如果src_image或dst_image是1D图像或1D图像缓冲区对象,则region[1]和region[2]必须为1。如果src_image或dst_image是1D图像阵列对象,则region[2]必须为1。region中的值不能为0。

  • event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. If event_wait_list is NULLnum_events_in_wait_list must be 0. If event_wait_list is not NULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_queue must be the same. The memory associated with event_wait_list can be reused or freed after the function returns.

  • event_wait_list和num_events_in_wait_list指定在执行此特定命令之前需要完成的事件。如果event_wait_list为NULL,则此特定命令不等待任何事件完成。如果event_wait_list为NULL,则num_events_in_wait_list必须为0。如果event_wait_list不为NULL,则event_wail_list指向的事件列表必须有效,并且num_events_in_wait_list必须大于0。event_wait_list中指定的事件充当同步点。与event_wait_list和command_queue中的事件关联的上下文必须相同。函数返回后,可以重用或释放与event_wait_list关联的内存。

  • event returns an event object that identifies this copy command and can be used to query or queue a wait for this command to complete. If event is NULL or the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not NULLevent must not refer to an element of the event_wait_list array.

  • event返回一个事件对象,该对象标识此复制命令,可用于查询或排队等待此命令完成。如果事件为NULL或排队不成功,则不会创建任何事件,因此无法查询此命令的状态或等待此命令完成。如果event_wait_list和event不为NULL,则event不能引用event_wail_list数组的元素。

It is currently a requirement that the src_image and dst_image image memory objects for clEnqueueCopyImage must have the exact same image format (i.e. the cl_image_format descriptor specified when src_image and dst_image are created must match).

​目前的要求是,clEnqueueCopyImage的src_image和dst_image映像内存对象必须具有完全相同的映像格式(即,创建src_image与dst_iimage时指定的cl_image_format描述符必须匹配)。

clEnqueueCopyImage returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

如果函数执行成功,clEnqueueCopyImage将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_COMMAND_QUEUE if command_queue is not a valid host command-queue.

  • CL_INVALID_COMMAND_QUEUE(如果命令队列不是有效的主机命令队列)。

  • CL_INVALID_CONTEXT if the context associated with command_queuesrc_image and dst_image are not the same or if the context associated with command_queue and events in event_wait_list are not the same.

  • CL_INVALID_CONTEXT如果与command_queue、src_image和dst_image关联的上下文不相同,或者如果与command _queue关联的语境和event_wait_list中的事件不相同。

  • CL_INVALID_MEM_OBJECT if src_image and dst_image are not valid image objects.

  • 如果src_image和dst_image不是有效的图像对象,则CL_INVALID_MEM_OBJECT。

  • CL_IMAGE_FORMAT_MISMATCH if src_image and dst_image do not use the same image format.

  • 如果src_IMAGE和dst_IMAGE不使用相同的图像格式,则CL_IMAGE_FORMAT_MISMATCH。

  • CL_INVALID_VALUE if src_origindst_origin, or region is NULL.

  • 如果src_origin、dst_oorigin或region为NULL,则CL_INVALID_VALUE。

  • CL_INVALID_VALUE if the 2D or 3D rectangular region specified by src_origin and src_origin + region refers to a region outside src_image, or if the 2D or 3D rectangular region specified by dst_origin and dst_origin + region refers to a region outside dst_image.

  • CL_INVALID_VALUE如果src_origin和src_origin+区域指定的2D或3D矩形区域指的是src_image之外的区域,或者如果dst_origin和dst_origin+区域规定的2D或三维矩形区域指代的是dst_image之外的区域。

  • CL_INVALID_VALUE if values in src_origindst_origin and region do not follow rules described in the argument description for src_origindst_origin and region.

  • CL_INVALID_VALUE如果src_origin、dst_origin和region中的值不遵循src_origins、dst_oorigin和region的参数描述中描述的规则。

  • CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.

  • CL_INVALID_EVENT_WAIT_LIST如果event_wait_list为NULL且num_events_in_wait_list>0,或者event_wait_list不为NULL且num_events_in_wait_list为0,或者如果event_wait_list 中的事件对象不是有效事件。

  • CL_INVALID_IMAGE_SIZE if image dimensions (image width, height, specified or compute row and/or slice pitch) for src_image or dst_image are not supported by device associated with queue.

  • CL_INVALID_IMAGE_SIZE如果与队列相关联的设备不支持src_imagedst_image的图像尺寸(图像宽度、高度、指定或计算行或切片间距)。

  • CL_IMAGE_FORMAT_NOT_SUPPORTED if image format (image channel order and data type) for src_image or dst_image are not supported by device associated with queue.

  • 如果与队列相关联的设备不支持src_IMAGE或dst_IMAGE的图像格式(图像通道顺序和数据类型),则CL_IMAGE_FORMAT_NOT_SUPPORTED。

  • CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for data store associated with src_image or dst_image.

  • 如果为与src_image或dst_image关联的数据存储分配内存失败,则CL_MEM_OBJECT_ALLOCATION_FAILURE。

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

  • CL_OUT_OF_RESOURCES,如果在设备上分配OpenCL实现所需的资源失败。

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_HOST_MEMORY,如果在主机上分配OpenCL实现所需的资源失败。

  • CL_INVALID_OPERATION if the device associated with command_queue does not support images (i.e. CL_DEVICE_IMAGE_SUPPORT specified in the Device Queries table is CL_FALSE).

  • CL_INVALID_OPERATION,如果与command_queue关联的设备不支持映像(即,在设备查询表中指定的CL_DEVICE_IMAGE_SUPPORT为CL_FALSE)。

  • CL_MEM_COPY_OVERLAP if src_image and dst_image are the same image object and the source and destination regions overlap.

  • CL_MEM_COPY_OVERLAP,如果src_image和dst_image是相同的图像对象并且源区域和目的区域重叠。

  • CL_INVALID_MIP_LEVEL if the cl_khr_mipmap_image extension is supported, and the mip level specified in src_origin or dst_origin is not a valid level for the corresponding src_image or dst_image,

  • CL_INVALID_MIP_LEVEL如果支持CL_khr_mipmap_image扩展,并且在src_origin或dst_origin中指定的MIP级别不是对应src_image或dst_image的有效级别,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值