Image objects specified as arguments to a
kernel can be declared to be read-only, write-only or
read-write. The __read_only
(or read_only
) and
__write_only
(or write_only
) qualifiers must be used with
image object arguments to declare if the image
object is being read or written by a kernel. The
__read_write
(or read_write
)
qualifier must be used with image object arguments to
declare if the image object is being both read and
written by a kernel. The default qualifier is
read_only
.
In the following example
kernel void |
imageA
is a read-only 2D image object, and
imageB
is a write-only 2D image object.
The sampler-less read image and write image built-ins
can be used with image declared with the
__read_write
(or read_write
) qualifier.
Calls to built-ins that read from an image
using a sampler for images declared with the
__read_write
(or read_write
) qualifier
will be a compilation error.
Pipe objects specified as arguments to a kernel can also use these access qualifiers. Refer to section 6.13.16 for a detailed description on how these access qualifiers can be used with pipes.
The __read_only
, __write_only
,
__read_write
, read_only
,
write_only
and read_write
names are reserved
for use as access qualifiers and shall not be used otherwise.