logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

clGetSupportedImageFormats - Get the list of image formats supported by an OpenCL implementation.

Authors

TheKhronosGroup

Errors

       Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns a NULL value with one
       of the following errors:

       •   CL_INVALID_CONTEXT if context is not a valid context.

       •   CL_INVALID_VALUE if flags or image_type are not valid, or if num_entries is 0 and image_formats is
           not NULL.

       •   CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation
           on the device.

       •   CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
           implementation on the host.

Name

       clGetSupportedImageFormats - Get the list of image formats supported by an OpenCL implementation.

       cl_intclGetSupportedImageFormats(cl_contextcontext,cl_mem_flagsflags,cl_mem_object_typeimage_type,cl_uintnum_entries,cl_image_format*image_formats,cl_uint*num_image_formats);

Notes

        1. OpenCL Specification
           page 96, section 5.3.2 - Querying List of Supported Image Formats

The Khronos Group                                  11/18/2024                         CLGETSUPPORTEDIMAGEF(3clc)

Parameters

context
           A valid OpenCL context on which the image object(s) will be created.

        flags
           A bit-field that is used to specify allocation and usage information about the image memory object
           being created and is described in the table below.
           ┌────────────────────────┬───────────────────────────────────────┐
           │ cl_mem_flagsDescription                           │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_READ_WRITE      │ This flag specifies that the memory   │
           │                        │ object will be read and written by a  │
           │                        │ kernel. This is the default.          │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_WRITE_ONLY      │ This flags specifies that the memory  │
           │                        │ object will be written but not read   │
           │                        │ by a kernel.                          │
           │                        │                                       │
           │                        │ Reading from a buffer or image object │
           │                        │ created with CL_MEM_WRITE_ONLY inside │
           │                        │ a kernel is undefined.                │
           │                        │                                       │
           │                        │ CL_MEM_READ_WRITE and                 │
           │                        │ CL_MEM_WRITE_ONLY are mutually        │
           │                        │ exclusive.                            │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_READ_ONLY       │ This flag specifies that the memory   │
           │                        │ object is a read-only memory object   │
           │                        │ when used inside a kernel.            │
           │                        │                                       │
           │                        │ Writing to a buffer or image object   │
           │                        │ created with CL_MEM_READ_ONLY inside  │
           │                        │ a kernel is undefined.                │
           │                        │                                       │
           │                        │ CL_MEM_READ_WRITE or                  │
           │                        │ CL_MEM_WRITE_ONLY and                 │
           │                        │ CL_MEM_READ_ONLY are mutually         │
           │                        │ exclusive.                            │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_USE_HOST_PTR    │ This flag is valid only if host_ptr   │
           │                        │ is not NULL. If specified, it         │
           │                        │ indicates that the application wants  │
           │                        │ the OpenCL implementation to use      │
           │                        │ memory referenced by host_ptr as the  │
           │                        │ storage bits for the memory object.   │
           │                        │                                       │
           │                        │ OpenCL implementations are allowed to │
           │                        │ cache the buffer contents pointed to  │
           │                        │ by host_ptr in device memory. This    │
           │                        │ cached copy can be used when kernels  │
           │                        │ are executed on a device.             │
           │                        │                                       │
           │                        │ The result of OpenCL commands that    │
           │                        │ operate on multiple buffer objects    │
           │                        │ created with the same host_ptr or     │
           │                        │ overlapping host regions is           │
           │                        │ considered to be undefined.           │
           │                        │                                       │
           │                        │ Refer to the dataTypes(3clc) for      │
           │                        │ host_ptr for memory objects (buffer   │
           │                        │ and images) created using             │
           │                        │ CL_MEM_USE_HOST_PTR.                  │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_ALLOC_HOST_PTR  │ This flag specifies that the          │
           │                        │ application wants the OpenCL          │
           │                        │ implementation to allocate memory     │
           │                        │ from host accessible memory.          │
           │                        │                                       │
           │                        │ CL_MEM_ALLOC_HOST_PTR and             │
           │                        │ CL_MEM_USE_HOST_PTR are mutually      │
           │                        │ exclusive.                            │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_COPY_HOST_PTR   │ This flag is valid only if host_ptr   │
           │                        │ is not NULL. If specified, it         │
           │                        │ indicates that the application wants  │
           │                        │ the OpenCL implementation to allocate │
           │                        │ memory for the memory object and copy │
           │                        │ the data from memory referenced by    │
           │                        │ host_ptr.                             │
           │                        │                                       │
           │                        │ CL_MEM_COPY_HOST_PTR and              │
           │                        │ CL_MEM_USE_HOST_PTR are mutually      │
           │                        │ exclusive.                            │
           │                        │                                       │
           │                        │ CL_MEM_COPY_HOST_PTR can be used with │
           │                        │ CL_MEM_ALLOC_HOST_PTR to initialize   │
           │                        │ the contents of the cl_mem object     │
           │                        │ allocated using host-accessible (e.g. │
           │                        │ PCIe) memory.                         │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_HOST_WRITE_ONLY │ This flag specifies that the host     │
           │                        │ will only write to the memory object  │
           │                        │ (using OpenCL APIs that enqueue a     │
           │                        │ write or a map for write). This can   │
           │                        │ be used to optimize write access from │
           │                        │ the host (e.g. enable write combined  │
           │                        │ allocations for memory objects for    │
           │                        │ devices that communicate with the     │
           │                        │ host over a system bus such as PCIe). │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_HOST_READ_ONLY  │ This flag specifies that the host     │
           │                        │ will only read the memory object      │
           │                        │ (using OpenCL APIs that enqueue a     │
           │                        │ read or a map for read).              │
           │                        │                                       │
           │                        │ CL_MEM_HOST_WRITE_ONLY and            │
           │                        │ CL_MEM_HOST_READ_ONLY are mutually    │
           │                        │ exclusive.                            │
           ├────────────────────────┼───────────────────────────────────────┤
           │ CL_MEM_HOST_NO_ACCESS  │ This flag specifies that the host     │
           │                        │ will not read or write the memory     │
           │                        │ object.                               │
           │                        │                                       │
           │                        │ CL_MEM_HOST_WRITE_ONLY or             │
           │                        │ CL_MEM_HOST_READ_ONLY and             │
           │                        │ CL_MEM_HOST_NO_ACCESS are mutually    │
           │                        │ exclusive.                            │
           └────────────────────────┴───────────────────────────────────────┘

        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_OBJECT_IMAGE1D_ARRAY or
           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
           A pointer to a memory location where the list of supported image formats are returned. Each entry
           describes a cl_image_format(3clc) structure supported by the OpenCL implementation. If image_formats
           is NULL, it is ignored.

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

See Also

cl_image_format(3clc)

Specification

OpenCLSpecification[1]

See Also