Write to DX11 texture


I’d like to map a DX11 texture to CUDA and write to it from a kernel. Is this even possible?

Mapping the texture using cudaGraphicsSubResourceGetMappedArray I get a cudaArray_t, but the only functions I can find in the Runtime API that operates on cudaArray_ts are texture creators, mallocs and memcpys.

Can I update a cudaArray_t from a kernel?


Generally, if you are interested in writing to textures, you would want to look for information on CUDA surfaces. Whether these have utility for DX11 interop, I cannot say, as I have had no exposure to CUDA/graphics interop.

You might also want to look at doing without interop, and staying completely on the graphics side with DirectX compute shaders.

I read about surfaces somewhere in relation to DX11 interop, but nothing concrete. I’ll start googling. Thanks.

Staying in DX11 land is not an option, as I’m actually just using CUDA as a middleman for transferring data to and from my OptiX backed path tracer. for now it works with an additional DX11 buffer, that I can map in CUDA and pass to OptiX, but the rest of my pipeline expects a texture, so it would be great if I could output directly to that.