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?