cudaArray & textures multiple textures?

So if I read this correctly I have to declare a global variable for every texture I want to use?
If that is the case, the only way to have multiple 2D textures, with their number determined at runtime, would be to stuff them into a 3D texture?
This would impact caching if the “different” textures were accessed randomly, and in the worst case not give any performance benefit at all over a bunch of simple arrays in global memory?

Maybe someone here can shed light on this for me.

Kind Regards,
Linny

Yes, texture references must be declared as global variables. You can however dynamically bind these texture references to different arrays from your host code at runtime.

Note that this is isn’t that different from OpenGL or Direct3D where there are a limited number of texture samplers.