Two of cudaChannelFormatDesc

I’m looking at the simpleTexture example and wondering why the call to cudaBindTextureToArray needs the third parameter; a cudaChannelFormatDesc. Surely cudaBindTextureToArray’s first parameter, a textureReference, has a member of the same type (cudaChannelFormatDesc), which stores the same values?

It’s very rare but legitimate to bind a texture with a channel format descriptor that describes a different type than what was in the texture reference.

e.g. one kernel’s array of shorts might be another kernel’s array of uchar2’s.

It’s important that the element sizes be the same obviously. But the layout and interpretation can be different.

Thanks. And so in that case, I’d have two different cudaChannelFormatDesc variables, which I’d provide as the third params of separate calls to cudaBindTextureToArray, say. Is that the general idea?

I’m trying to perform linear interpolation on integer texture types, but no luck yet.