In the previous chapter, we discussed the OpenCL buffers, which are the most important OpenCL objects. They represent the handle to the OpenCL device memory. We discussed how to create a buffer, sub-buffer, transfer the host allocated data to the device, and mapping or un-mapping of the OpenCL buffer. The OpenCL buffers provide caching for regular linear buffers only in one dimension. Many OpenCL devices have a texture processor, which can cache pixels in an image which are its neighbor. So providing a separate interface for images is useful, and can be used to enhance the performance of applications.
In this chapter we will discuss the OpenCL image objects, which are also represented by cl_mem
.
We will discuss the following topics:
Creating image and sampler objects
Performing histogram equalization using image objects. Mapping and querying the image objects.
Before we start, we need to mention that not all OpenCL devices support image computations. An OpenCL programmer...