CUDA纹理线性过滤 [英] CUDA Texture Linear Filtering
问题描述
在CUDA C编程指南第5版附录E.2(线性过滤)中,它指出:
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...
粗体部分使我困惑。 浮点型
是指只有texel类型,还是返回类型?例如,我声明3个纹理如下。
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;
线性过滤仅适用于 tex32f
或者 tex8u
和 tex16u
?
Is linear filtering available for tex32f
only, or also for tex8u
and tex16u
?
推荐答案
这意味着只有当纹理的读取模式 cudaReadModeNormalizedFloat
时,线性过滤才可用,即整数类型提升为[0.0,1.0](无符号整数)或[-1.0,1.0](有符号整数)范围内的浮点值。
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).
这篇关于CUDA纹理线性过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!