Can i use texture as a function parametter Bug in NVCC

We know that in OpenGL, texture is represented by a number. It seems natural to me that texture can be use as a function parameter.

So i did the same thing in CUDA

global void kernel(texture<float, 2> tex);

So that my kernel will give different result with different texture input (I hope so)

There’s no compile error, or linking error but

Segment fault (core dump)

Is this a bug with NVCC.

If i don’t use texture as the input parameter then everything is fine.

Textures cannot be kernel parameters. They must be declared globally in the .cu that contains the kernel using them.

If you would like to use a different texture, just do another cudaMemcpyToArray() to the texture array or bind the texture to a different array before calling the kernel.

Can you verify that. Because that what i did before. There’s a problem with that one that I experienced. If I want to perform the same function but with different size of texture. I don’t think i can change the size of the texture. I try it one and it did not change the size. That why i want to use another texture