Hello, I have run some samples that nvidia provides. But I can not undersand the funtion cuParamSetTexRef which is in SimpleTextureDrv. I check the cutil files and the Program Guide and find noting that descript it, Is there some place I can get the the description about it?
This function is indeed missing from the current documentation:
[font=“Courier”]CUresult cuParamSetTexRef(CUfunction func, unsigned int texunit, CUtexref texRef);[/font]
makes the CUDA array or linear memory bound to the texture reference texRef available to a device program as a texture. texunit gives the index of the texture sampler that the texture reference is to be bound to. For texture references whose handles were passed back by cuModuleGetTexRef(), the special value CU_PARAM_TR_DEFAULT directs the driver to infer this value from the module.
I still don’t fully understand this function. In my small driver API test program, the kernel seems to be able to access the texture even if I don’t call cuParamSetTexRef() at all. In my case, the texture reference was declared in the same module as my test kernel. When exactly is cuParamSetTexRef() neccessary to use? What if my cubin module has multiple textures?
Also, can I use texture references declared in one module from another module, maybe by declaring them extern? Some clarifications about how texture references work under the driver API would be great.