Probable usage of texture memory

Hello forum,

The simulation i am trying to run represents data on a 2D grid. The natural representation for this grid on the CPU is array . The analog of array on the GPU is the texture. So i believe that different type of data structure can be represented with 3/4 color channels. In my simulation i shall store the vector data represented as float2 in the texture and i am confused about its representation within color channels while creating the 2D texture and its access inside the kernel by sampler.

Some hint along with discussion will help me to get around this issue.


cl_mem initTexture(int width,int height)
{
   cl_int ciErrNum;

   cl_image_format image_format;
   image_format.image_channel_order = CL_RGBA;
   image_format.image_channel_data_type = CL_UNSIGNED_INT8;

   //create an empty image 
   cl_mem imageTexture = clCreateImage2D(cxGPUContext,CL_MEM_READ_WRITE,
					 &image_format,width,height,0,NULL,
					 &ciErrNum);
   oclCheckErrorEX(ciErrNum, CL_SUCCESS, pCleanup);

     

   return imageTexture;
}

The above snippet initialize the 2D texture. Please the texture will be containing the float2 type value which will be copied later from the host. Do i need to make any changes above to support float2 type?

What should i look out for while configuring the sampler ?

I shall be eagerly looking forward to your response.

Regards
Sajjad