cudaGraphicsD3D11RegisterResource doesn't work with D3D11 Structured Buffer?

Hi,

I’m working on a project that needs interop between D3D11 and CUDA. After created a D3D11 Buffer like this:
D3D11_BUFFER_DESC bufdesc;
bufdesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;
bufdesc.ByteWidth = sizeof(double) * N;
bufdesc.CPUAccessFlags = 0;
bufdesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
bufdesc.StructureByteStride = sizeof(double);
bufdesc.Usage = D3D11_USAGE_DEFAULT;

pd3dDevice->CreateBuffer(&bufdesc, NULL, &g_pVBIndex);

I registered it to CUDA with:
cudaGraphicsD3D11RegisterResource(&g_pGRIndex, g_pVBIndex, 0);

Strangely, in the D3D11 Shader, only the first N/sizeof(double) elements can be reached!

Since this never happened when I was using D3D11 alone, I remove the cudaGraphicsD3D11RegisterResource, and all rest elements just came back!

Is there anybody knows why? I’m using CUDA Toolkit 5.0, with 306.97 driver.

No one knows?

I’m getting a very similar problem, so resurrecting this since no one answered.

HLSL shader reads my structured buffer ID3D11Buffer just fine. Then all I do is register it with cudaGraphicsD3D11RegisterResource (seriously adding only this one line) and the structured buffer reads all ones (1.0f), losing all data stored in the buffer. I’m not running any kernels or doing any mapping.

Simply registering the buffer corrupts its usage.

Furthermore, if I register the buffer with CUDA, manipulate it in a kernel, and then deregister it before drawing, I can again read the buffer in my shader again. CUDA is correctly mapping it and manipulating it.

Something is guarding the resource from being read through a shader resource view when it is registered with CUDA.