This implies that I need to declare the texture as a global variable, in my main file, and keep the kernel in that same file so it has access to the texture.
Has this problem been fixed?
Is there any way I can pass a texture object? How else can the kernel access a texture object without having to be defined in the same file as where the texture object is defined?
As far as i know, textures are supposed to be declared global. Cant say ive actually tried to do otherwise yet but i could see why you would need this.
As far as being in the same file, all you need to do is #include another file with the texture in it if thats what youre looking for.
I usually put struct definitions, textures, and deviceconstant in a cuda_shared.cu file that all my kernel files #include.
One (very newbie) question: Do you have to build a custom build step for the cuda_shared.cu file as well? I assume so, but in that case would it be the same nvcc command that you use for the main.cu?
If in visual studio, i only compile the files with the kernel calls in them (not the actual global function definitions but the host code calling them) having #included those files.
Everything but the host code is set to “excluded from build”, including my cuda_shared file.