texture array or texture pointer want to dynamic allocate texture

I use CUDA 2.0 beta, and try to modify the smple project volumeRender.

The sample project use only one 3D texture for demo. But I want to use multiple volume for rendering.

When I try to declare the texture as texture array or a pointer of texture, the compile will return an error messenge:

identifier “tex” is undefined

It looks like that I can’t use a texture as a pointer, an can’t use a texture array?

How can I use multiple texture (the number of texture will decided in runtime) in CUDA? Can someone give me a suggest?

The original code is:

texture<unsigned char, 3, cudaReadModeNormalizedFloat> tex;

...

float sample = tex3D(tex, pos.x, pos.y, pos.z);

and the modified code:

texture<unsigned char, 3, cudaReadModeNormalizedFloat> *tex;

...

float sample = tex3D(*tex, pos.x, pos.y, pos.z);

Each texture must be a defined as a different global variable.

Current hardware doesn’t support indexing into an array of textures at runtime. (Actually, this is possible from DirectX 10 using texture arrays, but not for 3D textures).

The only solutions would be to do multiple tex3D fetches and select the correct result (which is wasteful), or pack all the volumes into a single 3D texture (which is subject to the maximum texture size).

If you just want to select the volume from the host, you can bind the texture to different 3D arrays in global memory.

so…
Is it impossible to use multiple texture with dynamic size?

By the way, I want to use more than one 3D texture in the same time.
And the 3D texture maximum is too small to combine all data @@

204820482048*4 bytes = 32 Gb. So the memory on GPU is too small for the coming years I guess…

mmm…you are right…

The 3D tecture size should be enough to store the data.

But the coming problem will be the waste of memory and time.

If the size of data are not the same, it will waste some memory for pack all the data. And it will take some time(I am not sure if it will be too long?) for combin the data into a 3D texture.