I have an ID3D11Texture3D with the following descriptor:
D3D11_TEXTURE3D_DESC td;
ZeroMemory(&td, sizeof(td));
td.Width = uiWidth;
td.Height = uiHeight;
td.Depth = uiDepth;
td.MipLevels = 1;
td.Format = DXGI_FORMAT_R32_FLOAT;
td.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
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?