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, also see cl_khr_depth_images extension:

int get_image_width(aQual image2d_depth_t image)
int get_image_width(aQual image2d_array_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, also see cl_khr_depth_images extension:

int get_image_height(aQual image2d_depth_t image)
int get_image_height(aQual image2d_array_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, also see cl_khr_depth_images extension:

int get_image_channel_data_type(aQual image2d_depth_t image)
int get_image_channel_data_type(aQual image2d_array_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]

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, also see cl_khr_depth_images extension:

int get_image_channel_order(aQual image2d_depth_t image)
int get_image_channel_order(aQual image2d_array_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, also see cl_khr_depth_images extension:

int2 get_image_dim(aQual image2d_depth_t image)
int2 get_image_dim(aQual image2d_array_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, also see cl_khr_depth_images extension:

size_t get_image_array_size(aQual image2d_array_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.

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-2023 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.