Description

The following built-in function calls to query image information are supported.

aQual in the following table refers to one of the access qualifiers. For query functions this may be read_only, write_only or read_write.

Table 1. Built-in Image Query Functions
Function Description

int get_image_width(aQual image2d_t image)
int get_image_width(aQual image3d_t image)

For OpenCL C 1.2 or newer:

int get_image_width(aQual image1d_t image)
int get_image_width(aQual image1d_buffer_t image)
int get_image_width(aQual image1d_array_t image)
int get_image_width(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

int get_image_width(aQual image2d_depth_t image)
int get_image_width(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

int get_image_width(aQual image2d_msaa_t image)
int get_image_width(aQual image2d_array_msaa_t image)
int get_image_width(aQual image2d_msaa_depth_t image)
int get_image_width(aQual image2d_array_msaa_depth_t image)

Return the image width in pixels.

int get_image_height(aQual image2d_t image)
int get_image_height(aQual image3d_t image)

For OpenCL C 1.2 or newer:

int get_image_height(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

int get_image_height(aQual image2d_depth_t image)
int get_image_height(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

int get_image_height(aQual image2d_msaa_t image)
int get_image_height(aQual image2d_array_msaa_t image)
int get_image_height(aQual image2d_msaa_depth_t image)
int get_image_height(aQual image2d_array_msaa_depth_t image)

Return the image height in pixels.

int get_image_depth(image3d_t image)

Return the image depth in pixels.

int get_image_channel_data_type(aQual image2d_t image)
int get_image_channel_data_type(aQual image3d_t image)

For OpenCL C 1.2 or newer:

int get_image_channel_data_type(aQual image1d_t image)
int get_image_channel_data_type(aQual image1d_buffer_t image)
int get_image_channel_data_type(aQual image2d_t image)
int get_image_channel_data_type(aQual image3d_t image)
int get_image_channel_data_type(aQual image1d_array_t image)
int get_image_channel_data_type(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

int get_image_channel_data_type(aQual image2d_depth_t image)
int get_image_channel_data_type(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

int get_image_channel_data_type(aQual image2d_msaa_t image)
int get_image_channel_data_type(aQual image2d_array_msaa_t image)
int get_image_channel_data_type(aQual image2d_msaa_depth_t image)
int get_image_channel_data_type(aQual image2d_array_msaa_depth_t image)

Return the channel data type. Valid values are:

CLK_SNORM_INT8
CLK_SNORM_INT16
CLK_UNORM_INT8
CLK_UNORM_INT16
CLK_UNORM_SHORT_565
CLK_UNORM_SHORT_555
CLK_UNORM_INT_101010
CLK_SIGNED_INT8
CLK_SIGNED_INT16
CLK_SIGNED_INT32
CLK_UNSIGNED_INT8
CLK_UNSIGNED_INT16
CLK_UNSIGNED_INT32
CLK_HALF_FLOAT
CLK_FLOAT

Additionally, for OpenCL C 3.0 or newer:

CLK_UNORM_INT_101010_2 [1]

Additionally, if the __opencl_c_ext_image_unorm_int_2_101010 feature is supported:

CLK_UNORM_INT_2_101010_EXT

Additionally, if the __opencl_c_ext_image_unsigned_10x6_12x4_14x2 feature macro is supported:

CLK_UNSIGNED_INT10X6_EXT
CLK_UNSIGNED_INT12X4_EXT
CLK_UNSIGNED_INT14X2_EXT
CLK_UNORM_INT10X6_EXT
CLK_UNORM_INT12X4_EXT
CLK_UNORM_INT14X2_EXT

int get_image_channel_order(aQual image2d_t image)
int get_image_channel_order(aQual image3d_t image)

For OpenCL C 1.2 or newer:

int get_image_channel_order(aQual image1d_t image)
int get_image_channel_order(aQual image1d_buffer_t image)
int get_image_channel_order(aQual image1d_array_t image)
int get_image_channel_order(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

int get_image_channel_order(aQual image2d_depth_t image)
int get_image_channel_order(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

int get_image_channel_order(aQual image2d_msaa_t image)
int get_image_channel_order(aQual image2d_array_msaa_t image)
int get_image_channel_order(aQual image2d_msaa_depth_t image)
int get_image_channel_order(aQual image2d_array_msaa_depth_t image)

Return the image channel order. Valid values are:

CLK_A
CLK_R
CLK_RG
CLK_RA
CLK_RGB
CLK_RGBA
CLK_ARGB
CLK_BGRA
CLK_INTENSITY
CLK_LUMINANCE

Additionally, for OpenCL C 1.1 or newer:

CLK_Rx
CLK_RGx
CLK_RGBx

Additionally, for OpenCL C 2.0 or newer:

CLK_ABGR
CLK_DEPTH
CLK_sRGB
CLK_sRGBx
CLK_sRGBA
CLK_sBGRA

int2 get_image_dim(aQual image2d_t image)

For OpenCL C 1.2 or newer:

int2 get_image_dim(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

int2 get_image_dim(aQual image2d_depth_t image)
int2 get_image_dim(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

int2 get_image_dim(aQual image2d_msaa_t image)
int2 get_image_dim(aQual image2d_array_msaa_t image)
int2 get_image_dim(aQual image2d_msaa_depth_t image)
int2 get_image_dim(aQual image2d_array_msaa_depth_t image)

Return the 2D image width and height as an int2 type. The width is returned in the x component, and the height in the y component.

int4 get_image_dim(aQual image3d_t image)

Return the 3D image width, height, and depth as an int4 type. The width is returned in the x component, height in the y component, depth in the z component and the w component is 0.

For OpenCL C 1.2 or newer:

size_t get_image_array_size(aQual image2d_array_t image)

For OpenCL C 2.0 or newer, or if the cl_khr_depth_images extension macro is supported:

size_t get_image_array_size(aQual image2d_array_depth_t image)

If the cl_khr_gl_msaa_sharing extension macro is supported:

size_t get_image_array_size(aQual image2d_array_msaa_depth_t image)

Return the number of images in the 2D image array.

For OpenCL C 1.2 or newer:

size_t get_image_array_size(aQual image1d_array_t image)

Return the number of images in the 1D image array.

If the cl_khr_gl_msaa_sharing extension macro is supported:

int get_image_num_samples(aQual image2d_msaa_t image)
int get_image_num_samples(aQual image2d_array_msaa_t image)
int get_image_num_samples(aQual image2d_msaa_depth_t image)
int get_image_num_samples(aQual image2d_array_msaa_depth_t image)

Return the number of samples in the 2D MSAA image

If the cl_khr_mipmap_image extension macro is supported:

int get_image_num_mip_levels(aQual image1d_t image)
int get_image_num_mip_levels(aQual image2d_t image)
int get_image_num_mip_levels(aQual image3d_t image)
int get_image_num_mip_levels(aQual image1d_array_t image)
int get_image_num_mip_levels(aQual image2d_array_t image)
int get_image_num_mip_levels(aQual image2d_depth_t image)
int get_image_num_mip_levels(aQual image2d_array_depth_t image)

Return the number of mip levels in image.

The values returned by get_image_channel_data_type and get_image_channel_order as specified in Built-in Image Query Functions with the CLK_ prefixes correspond to the CL_ prefixes used to describe the image channel order and data type in the OpenCL Specification. For example, both CL_UNORM_INT8 and CLK_UNORM_INT8 refer to an image channel data type that is an unnormalized unsigned 8-bit integer.

See Also

Document Notes

For more information, see the OpenCL C Specification

This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0


1. Although CL_UNORM_INT_101010_2 was added in OpenCL 2.1, because there was no OpenCL C 2.1 this image channel order requires OpenCL 3.0.