Hello,
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[0]= cudaAddressModeClamp;
tex.adressMode[1]= 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)
cudaBindTexture2D(0,tex,array,cudaCreateChannelDesc(8,0,0,0,cudaChannelFormatKindUnsigned),width,height,pitch);
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?
Thanks