beginner's question about texture reference

Hi there,

I am beginner to CUDA and I have a question about the compiling error:

“error: no instance of overloaded function “tex3D” matches the argument list” When

I am trying to reference data elements in a 3D texture:

texture<float4, 3, cudaReadModeNormalizedFloat> tex;

float u,v,w;

float4 P = tex3D(tex, u,v,w);

I wrote the above code by following the simpleTexture3D example in SDK:

texture<uchar, 3, cudaReadModeNormalizedFloat> tex;

float voxel = tex3D(tex, u, v, w);

Thanks a lot!

It looks correct, but why compiler complains? :ermm:

Is there anyone can help? :argh: Thanks!

My guess is that its just as the compiler says: there is no overloaded version of tex3D that returns a float4. You have the same problems when trying to adjust the type to just float or something else?

Yes, float3 and float2 are not supported for example. But other types like float, char…are ok. In fact, I successfully skipped this problem by using “__ftexfetch”, which is defined in texND(). I don’t know if this is a bug of compiler. :mad:

I have used float4’s for 2D texture fetching and everything was fine. What does your channel descriptor look like?

The channel descriptor is like this:

cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc();

I figured out the reason of compiler error: the cudaReadModeNormalizedFloat should be replaced by cudaReadModeElementType.