I’m fairly new to opencl and i mainly want to use it for image processing.
So my question is, whether it is generally better to use Image2D instead of a regular uchar Buffer? Especially considering that my kernels will only be dealing with image sizes of lets say 640x480 pixels.
In my experience, if you’re dealing with bytes - just use images. Use the UNORM_INT8 type and do all your maths using floats. For specific algorithms on some hardware you may get better performance with arrays, but to start with just sticking to images makes things easier and they work well for many algorithms.
If you’re using floats with fixed addressing (i.e. linear access, no interpolation) and need to do several iterations on read/write data i’ve found arrays can be a fair bit faster (at least on the hardware i’ve used), so as always - it depends on your algorithms and what you’re doing.
So if I understand you correctly, using images could make things a little easier (more handy) . But, does using them ever speed things up by any occasion? Or in other words, could using arrays instead of images slow things down?
Right now it seems that using images will in most cases not slow things down but will not speed them up either. So i might aswell use arrays for everything. Is that correct?