texture cudaFilterModeLinear for float4?


In the programming guide it reads: "cudaFilterModeLinear is only valid for returned

values of floating-point type."

Does this mean textures of type

texture<float4, 2, cudaReadModeElementType>

can not be interpolated, only

texture<float, 2, cudaReadModeElementType>




You can interpolate float2s and float4s. And also 16 bit floating point formats if you use the driver API.

Be aware that the hardware interpolator is 9bit precision only (it is built for RGBA8 image data). Use cudaReadModeElementType and do the interpolation in CUDA to get better precision.


This will also be much slower. It depends if you’re more concerned about speed or accuracy.

Well, lerp is not that expensive. In my experience, it is usually well hidden in the read latency as code pieces that do interpolation are usually memory bound anyway.


Thank you all! Got it working.
I am using the float4 interpolation now since accuracy is not very important to me.
Thanks for your help!

This is a bit misleading - to be exact the precision of the fractional part of the interpolant is 9-bit. This means there are only 2^9 possible interpolated positions between each texel, which can cause steps at large magnifications.

The resulting values will still be floating point.