let assume I have a texture :
texture<unsigned char,2,cudaReadModeElementType> tex;
I don’t want to have float element in the texture but unsigned char.
I want to have a linear interpolation between my datas.
The programming guide say : cudaFilterModeLinear is only valid for returned value of floating-point type.
So I define the texture like this :
tex.adressMode= cudaAddressModeClamp; tex.adressMode= cudaAddressModeClamp; tex.filterMode=cudaFilterModeLinear;//to have the interpolation tex.channelDesc= cudaCreateChannelDesc(32,0,0,0,cudaChannelFormatKindFloat);//to return value of floating-point type. tex.normalized=0;
Now the return value from texture is a floating-point type so normally I can use cudaFilterModeLinear.
I also bind the texture with an array (of unsigned char)
And finaly in the kernel i perform some computations and i copy them into an other array (of unsigned char)
__global__ myKernel(...) ... d_array2[index] = tex2D(tex,x,y); ...
I don’t get the correct values.
Someone know how to use filterModeLinear with unsigned char?