Click an item in the table below for details about that function.
read_imagef for 2D | Do an element lookup in the 2D image object, returning floating-point values |
read_image{i|ui} for 2D | Do an element lookup in the 2D image object, returning unnormalized signed integer and unsigned integer values |
read_imageh for 2D | OPTIONAL function to do an element lookup in the 2D image object, returning floating-point values. Enabled with cl_khr_fp16. |
write_image {f|i|ui} or 2D | Write color value to location in the 2D image object |
write_imageh for 2D | OPTIONAL function to write color value in a 3D object. Enabled with cl_khr_fp16. |
read_imagef for 3D | Do an element lookup in the 3D image object, returning floating-point values |
read_imagei for 3D | Do an element lookup in the 3D image object, returning unnormalized signed integer and unsigned integer values |
read_imageh for 3D | Do an element lookup in the 3D image object, returning half floating point values. Enabled with cl_khr_fp16. |
write_imageh for 3D | OPTIONAL function to write color value in a 3D object. Enabled with cl_khr_fp16. |
write_image{f i ui} for 3D | OPTIONAL function to write color value in a 3D object. Enabled with cl_khr_3d_image_writes. |
get_image_width | Return the image width in pixels |
get_image_height | Return the image height in pixels. |
get_image_depth | Return the 3D image depth in pixels |
get_image_channel_data_type | Return the image channel data type |
get_image_channel_order | Return the image channel order |
get_image_dim | Return the image dimensions |
The built-in image function calls to read and write images are supported.
The image read and write functions are extended with cl_khr_fp16 to include appropriate versions of functions that take half4 as arguments and return values.
The built-in functions defined in this section can only be used with image memory objects created with clCreateImage2D, or clCreateImage3D. An image memory object can be accessed by specific function calls that read from and/or write to specific locations in the image.
Image memory objects that are being read by a kernel should be declared with the __read_only qualifier. write_image calls to image memory objects declared with the __read_only qualifier will generate a compilation error. Image memory objects that are being written to by a kernel should be declared with the __write_only qualifier. read_image calls to image memory objects declared with the __write_only qualifier will generate a compilation error. read_image and write_image calls to the same image memory object in a kernel are not supported.
The read_image calls returns a four component floating-point, integer or unsigned integer color
value. The color values returned by read_image are identified as x, y, z, w
where x
refers to
the red component, y
refers to the green component, z
refers to the blue component and w
refers to the alpha component.
The image read functions take a sampler argument. The sampler can be passed as an argument to the kernel using clSetKernelArg, or it can be a constant variable of type sampler_t declared in the program source.