array of texture

Hi everyone,

I have a question about using an array of textures in CUDA.

I want to create an array of CUDA arrays and bind them with an array of textures (i.e. one texture by one CUDA array). Then, I want to interpolate each texture using text2D.

The code compiles when I only include the bind and unbind parts, but when I include the text2D call:


for (i = 0; i < number_textures; i++)
mypixel += tex2D( mytext[i], xref,yref);

I’m getting the following error: identifier “mytext” is undefined.

Of course I have “mytext” defined (bind and unbind parts are working).

Do you have any idea what it is going?

Thanks a lot

Due to limitations in the way textures are handled, they can only be declared as global-scope, implicity static, non-array variables. As you found, the compiler doesn’t give the most useful of warnings when you don’t follow these rules.

Thanks a lot, It is a really good explanation.