OpenCL specification provides two types of access qualifiers for different types of image memory objects. They can be either read_only
or write_only
. In the following example imageA
is read-only image object, and imageB
is a write-only image object:
__kernel void foo (read_only image2d_t imageA, write_only image2d_t imageB)
About function qualifiers and attributes, __kernel
qualifier declares a function which is defined explicitly to run on an OpenCL device. A __kernel
qualified function can be invoked inside another kernel function. In such a situation the kernel function just behaves as another function call. There are optional function attributes which can be specified for kernel functions.
The __kernel
qualified functions cannot return any data type. The return type is always void for those functions.
The keyword __attribute__
allows you to specify the special attributes for enums
, structs
, unions
, or to the functions or kernels. An attribute specifier...