C Specification
To get the list of image formats supported by an OpenCL implementation for a specified context, image type, and allocation information, call the function
// Provided by CL_VERSION_1_0
cl_int clGetSupportedImageFormats(
cl_context context,
cl_mem_flags flags,
cl_mem_object_type image_type,
cl_uint num_entries,
cl_image_format* image_formats,
cl_uint* num_image_formats);
Parameters
-
context is a valid OpenCL context on which the image object(s) will be created.
-
flags is a bit-field that is used to specify usage information about the image formats being queried and is described in the Memory Flags table. flags may be
CL_MEM_to query image formats that may be read from and written to by different kernel instances when correctly ordered by event dependencies, orREAD_ WRITE CL_MEM_to query image formats that may be read from by a kernel, orREAD_ ONLY CL_MEM_to query image formats that may be written to by a kernel, orWRITE_ ONLY CL_MEM_to query image formats that may be both read from and written to by the same kernel instance. flags may also beKERNEL_ READ_ AND_ WRITE CL_MEM_to query image formats that may be used to create immutable images. Please see Image Format Mapping for clarification.IMMUTABLE_ EXT -
image_type describes the image type and must be either
CL_MEM_,OBJECT_ IMAGE1D CL_MEM_,OBJECT_ IMAGE1D_ BUFFER CL_MEM_,OBJECT_ IMAGE2D CL_MEM_,OBJECT_ IMAGE3D CL_MEM_, orOBJECT_ IMAGE1D_ ARRAY CL_MEM_.OBJECT_ IMAGE2D_ ARRAY -
num_entries specifies the number of entries that can be returned in the memory location given by image_formats.
-
image_formats is a pointer to a memory location where the list of supported image formats are returned. Each entry describes a
cl_image_structure supported by the OpenCL implementation. If image_formats isformat NULL, it is ignored. -
num_image_formats is the actual number of supported image formats for a specific context and values specified by flags. If num_image_formats is
NULL, it is ignored.
Description
clGetSupportedImageFormats returns a union of image formats supported by all devices in the context.
clGetSupportedImageFormats returns CL_SUCCESS if the function is executed
successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_if context is not a valid context.CONTEXT -
CL_INVALID_if flags or image_type are not valid, or if num_entries is 0 and image_formats is notVALUE NULL. -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
If CL_DEVICE_ specified in the Device
Queries table is CL_TRUE, the values assigned to
CL_DEVICE_, CL_DEVICE_
CL_DEVICE_, CL_DEVICE_
CL_DEVICE_, CL_DEVICE_
CL_DEVICE_, and CL_DEVICE_ by the implementation
must be greater than or equal to the minimum values specified in the
Device Queries table.
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.