Binding linear memory to 2D texture is a copy made?

My understanding is that the hardware uses a special format to store textures and arrays (some sort space filling curve) which is different from the linear memory layout in CUDA. When we bind linear memory to a 2D texture, does a copy get created with the texture/array internal format? Or does the hardware operate on the linear memory with reduced performance (probably sub-optimal caching performance…)? Interpolation still seems to work.

I’m trying to save memory by avoiding having two copies of the same data, one as an array and the other linear, but if it happens anyway…there isn’t much point.

Thanks,
Erich

No copies. The texture hardware reads from the linear memory with (potentially) reduced performance.

Thanks. So then my followup question is: why is there a special function in 1-D for fetching from linear memory bound to a texture (tex1Dfetch vs tex1D), but not in 2-D? Is tex1D constrained by the inherent texture size limitation (which is probably 4096 x 4096 or 8192 x 8192…I’m not a graphics person) which would mean it could really only address 4096 or 8192 entries. But tex1Dfetch actually performs some linear to 2D conversion and then does the lookup?

That’s just the way it works. tex1Dfetch() is based on a feature (buffer textures) that was added in Direct3D 10. They’re different from normal 1D or 2D texture fetches - they don’t do any filtering, but can address up to 2^27 texels:

http://developer.download.nvidia.com/openg…ffer_object.txt