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 image1d_t image)
int get_image_width(aQual image1d_buffer_t image)
int get_image_width(aQual image2d_t image)
int get_image_width(aQual image3d_t image)
int get_image_width(aQual image1d_array_t image)
int get_image_width(aQual image2d_array_t image)
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)
int get_image_height(aQual image2d_array_t image)
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 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)
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_SHORT_101010
CLK_SIGNED_INT8
CLK_SIGNED_INT16
CLK_SIGNED_INT32
CLK_UNSIGNED_INT8
CLK_UNSIGNED_INT16
CLK_UNSIGNED_INT32
CLK_HALF_FLOAT
CLK_FLOAT

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 image2d_t image)
int get_image_channel_order(aQual image3d_t image)
int get_image_channel_order(aQual image1d_array_t image)
int get_image_channel_order(aQual image2d_array_t image)
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_Rx
CLK_RG
CLK_RGx
CLK_RA
CLK_RGB
CLK_RGBx
CLK_RGBA
CLK_ARGB
CLK_BGRA
CLK_INTENSITY
CLK_LUMINANCE
CLK_ABGR
CLK_DEPTH
CLK_sRGB
CLK_sRGBx
CLK_sRGBA
CLK_sBGRA

int2 get_image_dim(aQual image2d_t image)
int2 get_image_dim(aQual image2d_array_t image)
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.

size_t get_image_array_size(aQual image2d_array_t image)
size_t get_image_array_size(aQual image2d_array_depth_t image)

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

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 https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#table-image-query 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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.