Is there a way to access an ID3D11Texture3D in CUDA (read/write)?

I have an ID3D11Texture3D with the following descriptor:


ZeroMemory(&td, sizeof(td));

td.Width = uiWidth;

td.Height = uiHeight;

td.Depth = uiDepth;

td.MipLevels = 1;

td.Format = DXGI_FORMAT_R32_FLOAT;


I want to read and write to this texture using CUDA. Is this possible somehow?

I have tried the following:

[font=“Courier New”]cudaGraphicsD3D11RegisterResource >> cudaGraphicsMapResources >> cudaGraphicsSubResourceGetMappedArray[/font]

to READ: [font=“Courier New”]cudaBindTextureToArray >> tex3D[/font]

to WRITE: [font=“Courier New”]cudaMemcpy3D[/font] (from linear memory allocated with [font=“Courier New”]cudaMalloc3D[/font])

but the memory copy failes with [font=“Courier New”]cudaErrorInvalidValue[/font]:

cudaMemcpy3DParms oMemcpy3DParms;

memset(&oMemcpy3DParms, 0, sizeof(cudaMemcpy3DParms));

oMemcpy3DParms.srcPtr = oPitchedPtr;

oMemcpy3DParms.srcPos = make_cudaPos(0, 0, 0);

oMemcpy3DParms.dstArray = pArray;

oMemcpy3DParms.dstPos = make_cudaPos(0, 0, 0);

oMemcpy3DParms.extent = oExtent;

oMemcpy3DParms.kind = cudaMemcpyDeviceToDevice;

cudaError oCudaError = cudaMemcpy3D(&oMemcpy3DParms);

Any ideas? … or does it even work?

That works perfectly this way (just had to set a correct pitch) and well CUDA 4.1 even allows to bind surfaces to 3D cudaArrays (surf3Dread/surf3Dwrite).