| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" |
| "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd" [ |
| <!ENTITY clCreate_memflagsInc SYSTEM "clCreate_memflagsInc.xml"> |
| ]> |
| |
| <refentry> |
| <refentryinfo> |
| <keywordset> |
| <keyword>clGetSupportedImageFormats</keyword> |
| </keywordset> |
| </refentryinfo> |
| |
| <refmeta> |
| <refentrytitle> |
| clGetSupportedImageFormats |
| </refentrytitle> |
| |
| <refmiscinfo> |
| <copyright> |
| <year>2007-2013</year> |
| <holder>The Khronos Group Inc. |
| Permission is hereby granted, free of charge, to any person obtaining a |
| copy of this software and/or associated documentation files (the |
| "Materials"), to deal in the Materials without restriction, including |
| without limitation the rights to use, copy, modify, merge, publish, |
| distribute, sublicense, and/or sell copies of the Materials, and to |
| permit persons to whom the Materials are furnished to do so, subject to |
| the condition that this copyright notice and permission notice shall be included |
| in all copies or substantial portions of the Materials.</holder> |
| </copyright> |
| </refmiscinfo> |
| <manvolnum>3</manvolnum> |
| </refmeta> |
| |
| <!-- ================================ SYNOPSIS --> |
| |
| <refnamediv id="clGetSupportedImageFormats"> |
| <refname> |
| clGetSupportedImageFormats |
| </refname> |
| |
| <refpurpose> |
| Get the list of image formats supported by an OpenCL implementation. |
| </refpurpose> |
| </refnamediv> |
| |
| <refsynopsisdiv xmlns:xlink="http://www.w3.org/1999/xlink"> |
| <title></title> |
| <funcsynopsis> |
| <funcprototype> |
| <funcdef> |
| <link xlink:href="scalarDataTypes.html">cl_int</link> |
| <function>clGetSupportedImageFormats</function> |
| </funcdef> |
| |
| <paramdef><link xlink:href="abstractDataTypes.html">cl_context</link><parameter>context</parameter></paramdef> |
| <paramdef><link xlink:href="enums.html#cl_mem_flags">cl_mem_flags</link><parameter>flags</parameter></paramdef> |
| <paramdef><link xlink:href="enums.html#cl_mem_object_type">cl_mem_object_type</link><parameter>image_type</parameter></paramdef> |
| <paramdef><link xlink:href="scalarDataTypes.html">cl_uint</link><parameter>num_entries</parameter></paramdef> |
| <paramdef><link xlink:href="cl_image_format.html">cl_image_format</link><parameter>*image_formats</parameter></paramdef> |
| <paramdef><link xlink:href="scalarDataTypes.html">cl_uint</link><parameter>*num_image_formats</parameter></paramdef> |
| |
| </funcprototype> |
| </funcsynopsis> |
| </refsynopsisdiv> |
| |
| <!-- ================================ PARAMETERS --> |
| |
| <refsect1 id="parameters"> |
| <title>Parameters</title> |
| <variablelist> |
| |
| <varlistentry> |
| <term> <varname> context </varname> </term> |
| <listitem> |
| <para> |
| A valid OpenCL context on which the image object(s) will be created. |
| </para> |
| </listitem> |
| </varlistentry> |
| |
| <varlistentry> |
| <term> <varname> flags </varname> </term> |
| <listitem> |
| <para> |
| A bit-field that is used to specify allocation and usage information about |
| the image memory object being queried and is described in the table below. |
| To get a list of supported image |
| formats that can be read from or written to by a |
| kernel, <varname>flags</varname> must be set to |
| <constant>CL_MEM_READ_WRITE</constant> |
| (get a list of images that can be read from and written |
| to by different kernel instances when correctly ordered |
| by event dependencies), |
| <constant>CL_MEM_READ_ONLY</constant> (list of images |
| that can be read from by a kernel) or |
| <constant>CL_MEM_WRITE_ONLY</constant> (list of images |
| that can be written to by a kernel). To get a list of |
| supported image formats that can be both read from and |
| written to by a kernel, <varname>flags</varname> must be set |
| to <constant>CL_MEM_KERNEL_READ_AND_WRITE</constant>. |
| Please see section 5.3.2.2 for clarification. |
| </para> |
| |
| <!-- Table 5.3 --> |
| &clCreate_memflagsInc; |
| |
| </listitem> |
| </varlistentry> |
| |
| <varlistentry> |
| <term> <varname> image_type </varname> </term> |
| <listitem> |
| <para> |
| Describes the image type and must be either |
| <constant>CL_MEM_OBJECT_IMAGE1D</constant>, |
| <constant>CL_MEM_OBJECT_IMAGE1D_BUFFER</constant>, |
| <constant>CL_MEM_OBJECT_IMAGE2D</constant>, |
| <constant>CL_MEM_OBJECT_IMAGE3D</constant>, |
| <constant>CL_MEM_OBJECT_IMAGE1D_ARRAY</constant> or |
| <constant>CL_MEM_OBJECT_IMAGE2D_ARRAY</constant>. |
| </para> |
| </listitem> |
| </varlistentry> |
| |
| <varlistentry> |
| <term> <varname> num_entries </varname> </term> |
| <listitem> |
| <para> |
| Specifies the number of entries that can be returned in the memory location |
| given by <varname>image_formats</varname>. |
| </para> |
| </listitem> |
| </varlistentry> |
| |
| <varlistentry> |
| <term> <varname> image_formats </varname> </term> |
| <listitem> |
| <para> |
| A pointer to a memory location where the list of |
| supported image formats are returned. Each entry describes a |
| <citerefentry><refentrytitle>cl_image_format</refentrytitle></citerefentry> |
| structure supported by the OpenCL implementation. If |
| <varname>image_formats</varname> is NULL, it is ignored. |
| </para> |
| </listitem> |
| </varlistentry> |
| |
| <varlistentry> |
| <term> <varname> num_image_formats </varname> </term> |
| <listitem> |
| <para> |
| The actual number of supported image formats for a |
| specific <varname>context</varname> and values specified by |
| <varname>flags</varname>. If <varname>num_image_formats</varname> is NULL, |
| it is ignored. |
| </para> |
| </listitem> |
| </varlistentry> |
| </variablelist> |
| </refsect1> |
| |
| <!-- ================================ NOTES --> |
| |
| <refsect1 id="notes"><title>Notes</title> |
| <para> |
| <function>clGetSupportedImageFormats</function> can be used to get the list of image |
| formats supported by an OpenCL implementation when the following information about |
| an image memory object is specified: |
| </para> |
| |
| <itemizedlist mark="disc"> |
| <listitem> |
| Context |
| </listitem> |
| |
| <listitem> |
| Image type - 1D, 2D, or 3D image, 1D image buffer, 1D or 2D image array. |
| </listitem> |
| |
| <listitem> |
| Image object allocation information |
| </listitem> |
| |
| </itemizedlist> |
| |
| <para> |
| <function>clGetSupportedImageFormats</function> returns a union of image formats |
| supported by all devices in the context. |
| </para> |
| |
| <para> |
| If <constant>CL_DEVICE_IMAGE_SUPPORT</constant> specified in table 4.3 |
| (see <citerefentry><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry>) |
| is <constant>CL_TRUE</constant>, the values assigned to |
| <constant>CL_DEVICE_MAX_READ_IMAGE_ARGS</constant>, <constant>CL_DEVICE_MAX_WRITE_IMAGE_ARGS</constant>, |
| <constant>CL_DEVICE_IMAGE2D_MAX_WIDTH</constant>, <constant>CL_DEVICE_IMAGE2D_MAX_HEIGHT</constant>, |
| <constant>CL_DEVICE_IMAGE3D_MAX_WIDTH</constant>, <constant>CL_DEVICE_IMAGE3D_MAX_HEIGHT</constant>, |
| <constant>CL_DEVICE_IMAGE3D_MAX_DEPTH</constant> and <constant>CL_DEVICE_MAX_SAMPLERS</constant> by the |
| implementation must be greater than or equal to the minimum values specified in table 4.3 |
| (see <citerefentry><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry>). |
| </para> |
| |
| <bridgehead>Minimum List of Supported Image Formats</bridgehead> |
| |
| <para> |
| For 1D, 1D image from buffer, 2D, 3D image objects, 1D and 2D image array objects, the |
| mandated minimum list of image formats that must be supported by all devices (that can be read |
| from or written to by a kernel but not both) that support images is described |
| in the table below (Table 5.8a): |
| </para> |
| |
| <!-- table 5.8a --> |
| <informaltable frame="all"> |
| <tgroup cols="4" align="left" colsep="1" rowsep="1"> |
| <colspec colname="col1" colnum="1" /> |
| <colspec colname="col2" colnum="2" /> |
| <colspec colname="col3" colnum="3" /> |
| <colspec colname="col4" colnum="4" /> |
| |
| <thead> |
| <row> |
| <entry><literallayout>num_channels</literallayout></entry> |
| <entry><literallayout>channel_order</literallayout></entry> |
| <entry><literallayout>channel_data_type</literallayout></entry> |
| <entry><literallayout>read/write</literallayout></entry> |
| </row> |
| </thead> |
| |
| <tbody> |
| <row> |
| <entry><literallayout>1</literallayout></entry> |
| <entry><literallayout>CL_R</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8 |
| CL_UNORM_INT16 |
| CL_SNORM_INT8 |
| CL_SNORM_INT16 |
| |
| CL_SIGNED_INT8 |
| CL_SIGNED_INT16 |
| CL_SIGNED_INT32 |
| CL_UNSIGNED_INT8 |
| CL_UNSIGNED_INT16 |
| CL_UNSIGNED_INT32 |
| |
| CL_HALF_FLOAT |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| <entry><literallayout>read+write</literallayout></entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>1</literallayout></entry> |
| <entry><literallayout>CL_DEPTH</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT16 |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| <entry><literallayout>read+write</literallayout> |
| <constant>CL_DEPTH</constant> channel order is supported only for 2D image and 2D image array objects. |
| </entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>2</literallayout></entry> |
| <entry><literallayout>CL_RG</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8 |
| CL_UNORM_INT16 |
| CL_SNORM_INT8 |
| CL_SNORM_INT16 |
| |
| CL_SIGNED_INT8 |
| CL_SIGNED_INT16 |
| CL_SIGNED_INT32 |
| CL_UNSIGNED_INT8 |
| CL_UNSIGNED_INT16 |
| CL_UNSIGNED_INT32 |
| |
| CL_HALF_FLOAT |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| <entry><literallayout>read+write</literallayout></entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>4</literallayout></entry> |
| <entry><literallayout>CL_RGBA</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8 |
| CL_UNORM_INT16 |
| CL_SNORM_INT8 |
| CL_SNORM_INT16 |
| |
| CL_SIGNED_INT8 |
| CL_SIGNED_INT16 |
| CL_SIGNED_INT32 |
| CL_UNSIGNED_INT8 |
| CL_UNSIGNED_INT16 |
| CL_UNSIGNED_INT32 |
| |
| CL_HALF_FLOAT |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| <entry><literallayout>read+write</literallayout></entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>4</literallayout></entry> |
| <entry><literallayout>CL_BGRA</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8</literallayout></entry> |
| <entry><literallayout>read+write</literallayout></entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>4</literallayout></entry> |
| <entry><literallayout>CL_sRGBA</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8</literallayout></entry> |
| <entry> |
| read+write if the |
| <citerefentry><refentrytitle>cl_khr_srgb_image_writes</refentrytitle></citerefentry> |
| extension is supported, else read only. |
| sRGB channel order support is not required for 1D image buffers. |
| Writes to images with sRGB channel orders |
| requires device support of the |
| <citerefentry><refentrytitle>cl_khr_srgb_image_writes</refentrytitle></citerefentry> |
| extension. |
| </entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>1</literallayout></entry> |
| <entry><literallayout>CL_DEPTH_STENCIL</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT24 |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| <entry><literallayout>read only (applies if the |
| <citerefentry><refentrytitle>cl_khr_gl_depth_images</refentrytitle></citerefentry> |
| extension is enabled)</literallayout></entry> |
| </row> |
| |
| </tbody> |
| </tgroup> |
| </informaltable> |
| |
| <para> |
| For 1D, 1D image from buffer, 2D, 3D image objects, 1D and 2D image array objects, the |
| mandated minimum list of image formats that must be supported by all devices (that can be read |
| from and written to by a kernel) that support images is described |
| in the table below (Table 5.8b): |
| </para> |
| |
| |
| <!-- table 5.8b --> |
| <informaltable frame="all"> |
| <tgroup cols="3" align="left" colsep="1" rowsep="1"> |
| <colspec colname="col1" colnum="1" /> |
| <colspec colname="col2" colnum="2" /> |
| <colspec colname="col3" colnum="3" /> |
| |
| <thead> |
| <row> |
| <entry><literallayout>num_channels</literallayout></entry> |
| <entry><literallayout>channel_order</literallayout></entry> |
| <entry><literallayout>channel_data_type</literallayout></entry> |
| </row> |
| </thead> |
| |
| <tbody> |
| <row> |
| <entry><literallayout>1</literallayout></entry> |
| <entry><literallayout>CL_R</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8 |
| CL_SIGNED_INT8 |
| CL_SIGNED_INT16 |
| CL_SIGNED_INT32 |
| CL_UNSIGNED_INT8 |
| CL_UNSIGNED_INT16 |
| CL_UNSIGNED_INT32 |
| CL_HALF_FLOAT |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>4</literallayout></entry> |
| <entry><literallayout>CL_RGBA</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT8 |
| CL_UNORM_INT16 |
| CL_SIGNED_INT8 |
| CL_SIGNED_INT16 |
| CL_SIGNED_INT32 |
| CL_UNSIGNED_INT8 |
| CL_UNSIGNED_INT16 |
| CL_UNSIGNED_INT32 |
| CL_HALF_FLOAT |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| </row> |
| |
| <row> |
| <entry><literallayout>1</literallayout></entry> |
| <entry><literallayout>CL_DEPTH_STENCIL (applies if the |
| <citerefentry><refentrytitle>cl_khr_gl_depth_images</refentrytitle></citerefentry> |
| extension is enabled)</literallayout></entry> |
| <entry><literallayout>CL_UNORM_INT24 |
| CL_FLOAT |
| </literallayout> |
| </entry> |
| </row> |
| |
| </tbody> |
| </tgroup> |
| </informaltable> |
| |
| |
| <bridgehead> Image format mapping to OpenCL C image access qualifiers</bridgehead> |
| |
| <para> |
| Image arguments to kernels may have the <constant>read_only</constant>, <constant>write_only</constant> or <constant>read_write</constant> |
| qualifier. Not all image formats supported by the device and platform are valid to be passed to all |
| of these access qualifiers. For each access qualifier, only images whose format is in the list of |
| formats returned by clGetSupportedImageFormats with the given flag arguments in the table below are |
| permitted. It is not valid to pass an image supporting writing as both a read_only image and a |
| write_only image parameter, or to a read_write image parameter and any other image parameter. |
| </para> |
| |
| <!-- table 5.9 --> |
| <informaltable frame="all"> |
| <tgroup cols="2" align="left" colsep="1" rowsep="1"> |
| <colspec colname="col1" colnum="1" /> |
| <colspec colname="col2" colnum="2" /> |
| |
| <thead> |
| <row> |
| <entry><literallayout>Access Qualifier</literallayout></entry> |
| <entry><literallayout>cl_mem_flags</literallayout></entry> |
| </row> |
| </thead> |
| |
| <tbody> |
| <row> |
| <entry><constant>read_only</constant></entry> |
| <entry> |
| <constant>CL_MEM_READ_ONLY</constant>, |
| <constant>CL_MEM_READ_WRITE</constant>, |
| <constant>CL_MEM_KERNEL_READ_AND_WRITE</constant> |
| </entry> |
| </row> |
| |
| <row> |
| <entry><constant>write_only</constant></entry> |
| <entry> |
| <constant>CL_MEM_WRITE_ONLY</constant>, |
| <constant>CL_MEM_READ_WRITE</constant>, |
| <constant>CL_MEM_KERNEL_READ_AND_WRITE</constant> |
| </entry> |
| </row> |
| |
| <row> |
| <entry><constant>read_write</constant></entry> |
| <entry> |
| <constant>CL_MEM_KERNEL_READ_AND_WRITE</constant> |
| </entry> |
| </row> |
| |
| </tbody> |
| </tgroup> |
| </informaltable> |
| |
| |
| <bridgehead>Additional notes if the <citerefentry><refentrytitle>cl_khr_gl_depth_images</refentrytitle></citerefentry> |
| extension is enabled:</bridgehead> |
| |
| <para> |
| For the image format given by channel order of |
| <constant>CL_DEPTH_STENCIL</constant> and channel data type of |
| <constant>CL_UNORM_INT24</constant>, the depth is |
| stored as an unsigned normalized 24-bit value. |
| </para> |
| |
| <para> |
| For the image format given by channel order of |
| <constant>CL DEPTH_STENCIL</constant> and channel data type of |
| <constant>CL_FLOAT</constant>, each pixel is two 32-bit values. |
| The depth is stored as a single precision floating |
| point value followed by the stencil which is stored as a 8-bit integer value. |
| </para> |
| |
| <para> |
| The stencil value cannot be read or written using the |
| <function>read_imagef</function> and |
| <function>write_imagef</function> |
| built-in functions in an OpenCL kernel. |
| </para> |
| |
| <para> |
| Depth image objects with an image channel order = |
| <constant>CL_DEPTH_STENCIL</constant> cannot be used as |
| arguments to |
| <citerefentry><refentrytitle>clEnqueueReadImage</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clEnqueueWriteImage</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clEnqueueCopyImage</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clEnqueueCopyImageToBuffer</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clEnqueueCopyBufferToImage</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clEnqueueMapImage</refentrytitle></citerefentry> and |
| <citerefentry><refentrytitle>clEnqueueFillImage</refentrytitle></citerefentry> |
| and will return a <errorname>CL_INVALID_OPERATION</errorname> error. |
| </para> |
| |
| </refsect1> |
| |
| <!-- ================================ ERRORS --> |
| |
| <refsect1 id="errors"><title>Errors</title> |
| <para> |
| Returns <errorname>CL_SUCCESS</errorname> if the function is executed successfully. |
| Otherwise, it returns one of the following errors: |
| </para> |
| |
| <itemizedlist mark="disc"> |
| <listitem> |
| <errorname>CL_INVALID_CONTEXT</errorname> if <varname>context</varname> is not a valid context. |
| </listitem> |
| |
| <listitem> |
| <errorname>CL_INVALID_VALUE</errorname> if <varname>flags</varname> or |
| <varname>image_type</varname> are not valid, or if <varname>num_entries</varname> |
| is 0 and <varname>image_formats</varname> is not NULL. |
| </listitem> |
| |
| <listitem> |
| <errorname>CL_OUT_OF_RESOURCES</errorname> if there is a failure to allocate |
| resources required by the OpenCL implementation on the device. |
| </listitem> |
| |
| <listitem> |
| <errorname>CL_OUT_OF_HOST_MEMORY</errorname> if there is a failure to allocate |
| resources required by the OpenCL implementation on the host. |
| </listitem> |
| </itemizedlist> |
| </refsect1> |
| |
| <!-- ================================ EXAMPLE --> |
| <!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE --> |
| <!-- |
| <refsect2 id="example1"> |
| <title> |
| Example |
| </title> |
| |
| <informaltable frame="none"> |
| <tgroup cols="1" align="left" colsep="0" rowsep="0"> |
| <colspec colname="col1" colnum="1" /> |
| <tbody> |
| <row> |
| <entry> |
| Example goes here - it will be set in "code" type with white space preserved. |
| </entry> |
| </row> |
| </tbody> |
| </tgroup> |
| </informaltable> |
| </refsect2> |
| --> |
| |
| <!-- ================================ SPECIFICATION --> |
| <!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page |
| --> |
| <refsect1 id="specification"><title>Specification</title> |
| <para> |
| <imageobject> |
| <imagedata fileref="pdficon_small1.gif" format="gif" /> |
| </imageobject> |
| |
| <olink uri="clGetSupportedImageFormats">OpenCL Specification</olink> |
| </para> |
| </refsect1> |
| |
| <!-- ================================ ALSO SEE --> |
| |
| <refsect1 id="seealso"><title>Also see</title> |
| <para> |
| <citerefentry><refentrytitle>cl_image_format</refentrytitle></citerefentry>, |
| <citerefentry><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry> |
| </para> |
| </refsect1> |
| |
| <!-- ================================ COPYRIGHT --> |
| <!-- Content included from copyright.inc.xsl --> |
| |
| <refsect3 id="Copyright"><title></title> |
| <imageobject> |
| <imagedata fileref="KhronosLogo.jpg" format="jpg" /> |
| </imageobject> |
| <para /> |
| </refsect3> |
| |
| <!-- 26-Oct-2015, API rev. 19 --> |
| </refentry> |
| |