A question about vector interpolation in CUDA

Hi,

Recently I have been up to a project doing some 3d simulations. Solving some of the problems involving some 3d vector field calculations. I spent a few days searching an API in CUDA that can simply do the interpolation to the 3d vectors, just like the following code in GLSL:

vec4 result = texture(3d_texture_reference, normalized_coordinates);

The variable ‘3d_texture_reference’ is a reference to a 3d-texture, of format GL_RGB32F, with each element representing a velcoity in different directions.

I found something similar in CUDA like tex3D(), but it seems to have some limitations. Eventhough I set the filter mode to ‘cudaFilterModeLinear’, with the texture read mode of ‘cudaReadModeElementType’, the interpolation doesn’t work. And if I change the read mode to ‘cudaReadModeNormalizedFloat’, the API requires the return type to be a float, which conflicts with my goal that doing the interpolation to vectors.
Of course, implementing my own interpolation is an option, but I would rather use a native one considering both convience and performance.

Will you guys give me some hints?

Thanks!

Sorry everyone, the question actually doesn’t exist.

I’ve reviewed my experiment results again, and found that the values returned by tex3D() are correct. The problem is actually the ‘standard data’ for comparison.

So the ‘answer’ is clear: CUDA can perfectly do interpolation to vector variables. What had confused me was the description in CUDA programming guide, which saids:

<b><i>cudaFilterModeLinear is only valid for returned values of floating-point type.</i></b>(3.2.11.1. Texture Memory)

What it is trying to say is(I guess), for returned values of floating-point type any of the 1-, 2-, and 4-component vector types.

This is why I was led to a wrong direction in the first place that keep seeking another API for doing the simple thing.