问题
In the CUDA C Programming Guide Version 5, Appendix E.2 (Linear Filtering), it is stated that:
In this filtering mode, which is only available for floating-point textures, the value returned by the texture fetch is...
The part in bold case is confusing me. Does floating point
mean the texel type only, or the return type also? For example, I declare 3 textures as follows.
texture<float,cudaTextureType2D> tex32f;
texture<unsigned char, cudaTextureType2D, cudaReadModeNormalizedFloat> tex8u;
texture<unsigned short, cudaTextureType2D, cudaReadModeNormalizedFloat> tex16u;
Is linear filtering available for tex32f
only, or also for tex8u
and tex16u
?
回答1:
It means that linear filtering is available only when the "read mode" of the texture is cudaReadModeNormalizedFloat
, i.e. integer types (such as u8) get promoted to floating point values in the range [0.0, 1.0] (for unsigned integers) or [-1.0, 1.0] (for signed integers).
来源:https://stackoverflow.com/questions/14112701/cuda-texture-linear-filtering