array of texture pointers

Is it possible to declare an array of texture pointers?

I’ve given it a shot with the following code:

__device__ texture<float, 1, cudaReadModeElementType>* tex_pointers[2];

texture<float, 1, cudaReadModeElementType> tex0;

texture<float, 1, cudaReadModeElementType> tex1;

but it fails to compile with the following error message:

### Assertion failure at line 2129 of ../../be/cg/NVISA/cgtarget.cxx:

### Compiler Error in file /tmp/tmpxft_00004f3c_00000000-9_kernel.cpp3.i during Code_Expansion phase:

### asm m constraint must have simple variable

nvopencc INTERNAL ERROR: /usr/local/cuda/open64/lib//be returned non-zero status 1

It is currently not possible to create arrays of texture references. Currently available alternatives are:

(1) Select textures on the fly via if-statement or switch(). I have used this successfully in application code and the efficiency is good if the number of textures is small.
(2) Create an array of function pointers for access functions, one read function per texture. This was recently proposed in a forum post, and I have not yet had a chance to evaluate this approach.

BTW, are you using CUDA 4.0 final? I was under the impression that we managed to eliminate the internal compiler error due to use of an array of texture references so that the compiler now gives a “proper” error message. Can’t say for sure though whether this made it in.

No, I am using CUDA 3.2.