I’m working on a project that needs interop between D3D11 and CUDA. After created a D3D11 Buffer like this:
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.