CLENQUEUECOPYIMAGE(3clc)
π CLENQUEUECOPYIMAGE π
ok so this is the OpenCL Manual, section 3clc, and bestie we are about to copy some images. π¦ no cap.
β¨ NAME β¨
clEnqueueCopyImage β enqueues a command to copy image objects. that's the whole vibe, that's the assignment. π
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);
πΈ PARAMETERS πΈ
command_queueβ this is the command-queue where your copy command is gonna get queued. lowkey important: the OpenCL context tied tocommand_queue,src_imageanddst_imagehas to be the same one. no mixing contexts, that's not the vibe.src_image,dst_imageβ these can be 1D, 2D, 3D images, or 1D / 2D image array objects, which unlocks all of these little moves for us: π- Copy a 1D image object to a 1D image object.
- Copy a 1D image object to a scanline of a 2D image object and vice-versa.
- Copy a 1D image object to a scanline of a 2D slice of a 3D image object and vice-versa.
- Copy a 1D image object to a scanline of a specific image index of a 1D or 2D image array object and vice-versa.
- Copy a 2D image object to a 2D image object.
- Copy a 2D image object to a 2D slice of a 3D image object and vice-versa.
- Copy a 2D image object to a specific image index of a 2D image array object and vice versa.
- Copy images from a 1D image array object to a 1D image array object.
- Copy images from a 2D image array object to a 2D image array object.
- Copy a 3D image object to a 3D image object.
src_originβ the source's offset, bestie. it defines the(x, y, z)offset in pixels in the 1D, 2D or 3D image, the(x, y)offset plus the image index in the 2D image array, or the(x)offset plus the image index in the 1D image array. the rules, and yes they are strict:- If image is a 2D image object,
src_origin[2]must be0. - If
src_imageis a 1D image object,src_origin[1]andsrc_origin[2]must be0. - If
src_imageis a 1D image array object,src_origin[2]must be0. - If
src_imageis a 1D image array object,src_origin[1]describes the image index in the 1D image array. - If
src_imageis a 2D image array object,src_origin[2]describes the image index in the 2D image array.
- If image is a 2D image object,
dst_originβ same energy, but for the destination. it defines the(x, y, z)offset in pixels in the 1D, 2D or 3D image, the(x, y)offset plus the image index in the 2D image array, or the(x)offset plus the image index in the 1D image array. the rules:- If
dst_imageis a 2D image object,dst_origin[2]must be0. - If
dst_imageis a 1D image or 1D image buffer object,dst_origin[1]anddst_origin[2]must be0. - If
dst_imageis a 1D image array object,dst_origin[2]must be0. - If
dst_imageis a 1D image array object,dst_origin[1]describes the image index in the 1D image array. - If
dst_imageis a 2D image array object,dst_origin[2]describes the image index in the 2D image array.
- If
regionβ the size of the zone we're copying, fr fr. it defines the(width, height, depth)in pixels of the 1D, 2D or 3D rectangle, the(width, height)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. the constraints:- If
src_imageordst_imageis a 2D image object,region[2]must be1. - If
src_imageordst_imageis a 1D image or 1D image buffer object,region[1]andregion[2]must be1. - If
src_imageordst_imageis a 1D image array object,region[2]must be1.
- If
event_wait_list,num_events_in_wait_listβ these specify the events that need to finish before this particular command can even think about executing. the deets: π- If
event_wait_listisNULL, then this particular command does not wait on any event to complete. - If
event_wait_listisNULL,num_events_in_wait_listmust be0. - If
event_wait_listis notNULL, the list of events pointed to byevent_wait_listmust be valid andnum_events_in_wait_listmust be greater than0. - The events specified in
event_wait_listact as synchronization points. β¨ - The context associated with events in
event_wait_listandcommand_queuemust be the same. - The memory associated with
event_wait_listcan be reused or freed after the function returns.
- If
eventβ returns an event object that identifies this particular copy command, and you can use it to query or queue a wait for this particular command to complete.eventcan beNULL, 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.clEnqueueBarrierWithWaitList(3clc)can be used instead. and heads up: if theevent_wait_listand theeventarguments are notNULL, theeventargument should not refer to an element of theevent_wait_listarray. π
π NOTES π
so right now it is a requirement that the src_image and dst_image image memory objects for clEnqueueCopyImage must have the exact same image format. like, the cl_image_format(3clc) descriptor specified when src_image and dst_image are created must match. matching fits only. periodt.
π₯ ERRORS π₯
clEnqueueCopyImage returns CL_SUCCESS if the function is executed successfully. otherwise, it returns one of these:
CL_INVALID_COMMAND_QUEUEifcommand_queueis not a valid command-queue.CL_INVALID_CONTEXTif the context associated withcommand_queue,src_imageanddst_imageare not the same or if the context associated withcommand_queueand events inevent_wait_listare not the same.CL_INVALID_MEM_OBJECTifsrc_imageanddst_imageare not valid image objects.CL_IMAGE_FORMAT_MISMATCHifsrc_imageanddst_imagedo not use the same image format.CL_INVALID_VALUEif the 2D or 3D rectangular region specified bysrc_originandsrc_origin + regionrefers to a region outsidesrc_image, or if the 2D or 3D rectangular region specified bydst_originanddst_origin + regionrefers to a region outsidedst_image.CL_INVALID_VALUEif values insrc_origin,dst_originandregiondo not follow rules described in the argument description forsrc_origin,dst_originandregion.CL_INVALID_EVENT_WAIT_LISTifevent_wait_listisNULLandnum_events_in_wait_list>0, orevent_wait_listis notNULLandnum_events_in_wait_listis0, or if event objects inevent_wait_listare not valid events.CL_INVALID_IMAGE_SIZEif image dimensions (image width, height, specified or compute row and/or slice pitch) forsrc_imageordst_imageare not supported by device associated with queue.CL_INVALID_IMAGE_FORMATif image format (image channel order and data type) forsrc_imageordst_imageare not supported by device associated with queue.CL_MEM_OBJECT_ALLOCATION_FAILUREif there is a failure to allocate memory for data store associated withsrc_imageordst_image.CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.CL_INVALID_OPERATIONif the device associated withcommand_queuedoes not support images (i.e.CL_DEVICE_IMAGE_SUPPORTspecified in the table of OpenCL Device Queries forclGetDeviceInfo(3clc)isCL_FALSE).CL_MEM_COPY_OVERLAPifsrc_imageanddst_imageare the same image object and the source and destination regions overlap.
π SPECIFICATION π
OpenCL Specification[1]
π SEE ALSO π
clEnqueueReadImage(3clc), clEnqueueWriteImage(3clc)
π«Ά AUTHORS π«Ά
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π§ NOTES π§
- OpenCL Specification page 104, section 5.3.3 - Reading, Writing and Copying Image Objects
and that's the whole page, bestie!! π this came to you from The Khronos Group, dated 01/14/2021, and it's the CLENQUEUECOPYIMAGE(3clc) page β go copy some images, you're gonna ate. π
β¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms