more texture questions texture references

I have two questions about textures that I couldn’t answer with the guide:

  1. Are arrays of textures allowed? I tried this:
    texture<float, 2, cudaReadModeElementType> tex_images[MAX_IMAGES];

    tmp = texfetch(tex_images[n], x, y);

The declaration compiles fine, but on the fetch I get a compiler error that says “identifier “tex_images” is undefined.” It works fine if tex_images is not an array.

  1. Is there an elegant way to write into a texture from a kernel running on the device?

What I want to do here is take an arbitrary (not large, but not known a-priori) number of 2-D textures and do some operations on them in order to generate a resulting 2-D texture. Then I invoke a different kernel that does more operations on the result texture (that part seems to work fine).

Any help is appreciated!


  1. Arrays of textures are not implemented yet:
    See also here:

  2. I guess this is only possible using a device-to-device copy, as is done in the fluidsGL example of the SDK (look for updateTexture).

Ok, I can work around it for the moment. Are there plans to implement arrays of textures soon?