Hi forum,

I am calculating the pitch value for the device i am working on in the following manner:

Code :
      //pull out the device info for the optimal texture pitch
      cl_uint deviceMemBaseAddressAlignmentInBits;      
      unsigned int deviceMemBaseAddressAlignmentInBytes;
      //get the device info
      //describes the alignment in bits of the base address of any allocated
      //memory object
      errNum = clGetDeviceInfo(cdDevices[0],
      if( errNum != CL_SUCCESS )
	 std::cerr << "Device Memory Base Address Alignment Extraction is not successful." << std::endl;
	 return NULL;
      //convert bits to bytes
      deviceMemBaseAddressAlignmentInBytes = deviceMemBaseAddressAlignmentInBits / 8;
      unsigned int remainingAlignmentBytes = (DIM*sizeof(cl_float2)) % deviceMemBaseAddressAlignmentInBytes;
      if( remainingAlignmentBytes != 0 )
	 tPitch = (DIM*sizeof(cl_float2)) + (deviceMemBaseAddressAlignmentInBytes - remainingAlignmentBytes);
	 //returns basically the image row pitch
	 tPitch =  (DIM*sizeof(cl_float2)); // no additional bytes required.

I need your feed-back over this issue to make sure that i am doing it right.