Attempting to define a class with a per-instance texture. Yes, the number of instances of that class will be small. To work around the restriction that CUDA texture must be a global variable, I tried the following approach:
- Define a global table of textures.
- Add an instance-ID data member to the class.
- Have a class method select a texture from the table using its ID, and pass it as an argument to a CUDA kernel.
Doesn't work. A texture cannot be passed as an argument (nor by pointer or reference), and the kernel doesn't recognize the array name, barring passing by index. I could probably do it with a switch statement, but that is ugly. Any suggestions?