I tried working with OpenGL textues in two ways :
- I created OpenGL textures and used clCreateFromGLTexture2D to transfer the handles to my kernels ,sampled the textures and then wrote my pixels to a destination texture
- I created textures using clCreateImage2D, handed over their handles to the kernel, sampled the textures and then wrote them to a destination texture.
all surfaces are RGBA which takes 32 bits per pixel (R=8bits,G=8Bits,B=8Bits, A= 8 Bits)
I noticed that on the first case using the same sampler (nearest, non normalized, clamped edges) the following call:
float4 vec4fColor = read_imagef(…)
On the second time , using the same function on the surface created with clCreateImage2D never worked. What saved me was read_imageui(…) which worked well.
Can anyone explain how is it that for case 1 there is an implicit conversion to float4 (After all , the surface is RGBA with 8 bits per component) and at case 2 I need to explicitly do the conversion ?