rectangular textures

Are rectangular textures allowed in CUDA ? I created a texture of dimension (256*207,256). But when I access the elements I get an offset of 49152. This doesn’t seem to be a problem if the texture is a 2D texture( i.e. a square texture)

texture<float,2,cudaReadModeElementType> FPtex;

cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32,0,0,0,cudaChannelFormatKindFloat);;

const int COL_SZ = 256*207;
const int ROW_SZ = 256;
CUDA_SAFE_CALL( cudaMallocArray( &arr, &channelDesc, COL_SZ, ROW_SZ ));

Has an offset of 49152 when accessing texels. While COL_SZ=ROW_SZ=256*15 seems to return the right texels.


BTW, I used tex2D function to access the texture. Is there a separate function for rectangular textures ? Am I missing something ?

There is no restriction in the width/height ratio of your textures, so rectangular textures of any weird non power of two dimensions are not a problem. although there certainly is a maximum width. I don’t know the exact number, but it’s in the developer guide.

You may be right. I think I am hitting some kind of a limit