CUDA textures : How to update the filtering?

Viewed 48

Like said here in the doc, we can create a texture with linear filtering. But in OpenGL, we can set the filtering for example setting linear to nearest after having created the texture with glTexParameteri.

Can we do so with CUDA?

If not, that would mean we have to recreate a texture with cudaCreateTextureObject. So as auxiliary question, is cudaCreateTextureObject() a cheap call ? That seems to be the case because the textures depends on array that have already been uploaded to the GPU, and this defines only the parameters on the textures.

1 Answers

No, you cannot update texture behavior, after a call to cudaCreateTextureObject(), without another call to cudaCreateTextureObject().

In my testing, a call to cudaCreateTextureObject typically would cost between 5 and 50 microseconds, which is fairly typical for CUDA runtime API library calls (for example, cudaStreamCreate in the same test case cost 8-9us each.) More specifically, in an application with a sequence of 4 calls, the first call cost about 40us whereas each of the 3 subsequent calls cost less than 10us each.

YMMV. You can decide if that is "cheap".

Related