Considering OpenCL kernels are executed on the same units as shaders it would seem logical to me for OpenCL to have the same data types as GLSL, yet looking here: http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/dataTypes.html I don't see a matrix type.
Why is that?
Also, does it mean if I want to multiply 4x4 matrices it will be slower when using OpenCL than GLSL?
Actually, if you look at your link more closely there are matrix data types in the category of reserved datatypes: floatnxm, doublenxm. So it is quite likely that there will be implementation for those types in future releases of the standard. I have no idea why they haven't done that already.
At this point you can use either an array or image2d_t to represent matrices. You probably want to take a look at this article
What comes to the speed. It doesn't necessarily mean that OpenCL is slower, but it is quite likely. Even if you manage to write the perfect matrix multiplication code for one platform with OpenCL, in some other platform performance can be quite poor. In OpenGL, manufacturers are writing their own matrix multiplication code which should be quite optimal for each platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With