在 CUDA C Programming Guide Version 5, Appendix E.2 (Linear Filtering) 中,指出:
In this filtering mode, which is only available for floating-point textures, the value returned by the texture fetch is...
粗体部分让我很困惑。 floating point
仅表示纹素类型,还是还表示返回类型?比如我声明3个贴图如下。
texture<float,cudaTextureType2D> tex32f;
texture<unsigned char, cudaTextureType2D, cudaReadModeNormalizedFloat> tex8u;
texture<unsigned short, cudaTextureType2D, cudaReadModeNormalizedFloat> tex16u;
线性过滤是否仅适用于 tex32f
,或者也适用于 tex8u
和 tex16u
?
最佳答案
这意味着只有当纹理的“读取模式”为 cudaReadModeNormalizedFloat
时,线性过滤才可用,即整数类型(例如 u8)被提升为 [0.0, 1.0](对于无符号整数)或 [-1.0, 1.0](对于有符号整数)。
关于CUDA 纹理线性过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14112701/