CUDA-DirectX interoperability question

Hi,

I’m tried to use CUDA interoperability with DirectX, but when rendering a texture only the value of the first pixel is been painted on the whole window.

Here is my code:
…create window and init direct3D here, then:
V( DXUTGetD3D9Device()->CreateTexture(X, Y, 1, 0, D3DFMT_L16,
D3DPOOL_DEFAULT, &texture, NULL));
cu_err = cudaD3D9SetDirect3DDevice(dev);
cu_err = cudaD3D9RegisterResource(tex,cudaD3D9RegisterFlagsNone);
cu_err = cudaD3D9MapResources(1, (IDirect3DResource9 *) &tex);
void
dst;
cudaD3D9ResourceGetMappedPointer(&dst, tex, 0, 0);
unsigned short * test;
test = new unsigned short[XY];
test[0] =65535;
for (int i = 1; i < x
y; i++)
test[i] = (unsigned short) 32000;
cudaMemcpy((unsigned short ) dst, test,
X
Y*sizeof(unsignedshort),cudaMemcpyHostToDevice);
cudaD3D9UnmapResources(1, (IDirect3DResource9 **) &tex);
cudaD3D9UnregisterResource((IDirect3DResource9 *) tex);
… and draw scene here.

Does anyone have any suggestions about what my problem could be?

Please if you need more lines from my code I would be happy to post them, I just did not want to fill up the screen with so many lines related with the initialization of DirectX and with drawing the scene.

Thanks a lot.