Get texture size in kernel?

Is there a way to get the size or dimensions of a texture in kernel code? (The SDK texture examples pass the dimensions as arguments.)

If not, would be a handy feature…


I don’t think such a facility is available in cuda.

Also, I think there is no meaning having such a facility. Since you can’t event change the data inside the texture, once the kernel is started. So before starting the kernel you know its attributes anyway. Passing them as arguments or through constant variables will be much faster than identifying its size with in the kernel during execution for each and every thread. isn’t?

I agree this would occasionally be useful. The hardware actually has instructions for this (see TXQ in DirectX 10), but I don’t think we have any plans to add it to CUDA.

Thanks Simon. Something for the wishlist… :-)

Sibi, That’s what I’m doing now, but it means passing and keeping track of a lot of parameters, and passing them around to device functions (or putting them in shared memory, which is scarce).