I want to use tex1D () to interpolate between adjacent entries in a constant coefficient table. I understand that this must be done from a CUDA Array. But I don’t see how to transfer data to a 1D array so thet tex1D can look it up.
I set up a 1D tecture:
texture<float, 1, cudaReadModeElementType> filterTex ;
Later, I tweak it to do the linear interpolation:
filterTex.filterMode = cudaFilterModeLinear ;
I don’t see how I can do this at compile time, so I presume I have to do it at run time.
I set up my format description
cudaChannelFormatDesc formatDesc = cudaCreateChannelDesc () ;
I create a CUDA Array and bind it to my Texture
cudaArray* cuArray ;
cudaCall (cudaMallocArray (&cuArray, &formatDesc, WIDTH, 1)) ;
cudaCall (cudaBindTextureToArray (filterTex, cuArray)) ;
Now I want to copy my coefficients into the array. But the only way I can see to do this is cudaMemcpyToArray or cudaMemcpy2DToArray(), both of which appear to be 2-D operations. If I try to “fool” them by giving a height of 1, they give me an Invalid parameter error.
I am obviously missing something here. Any suggestions?