I am struggling with reading from a D3D11 2D texture (writing works), where I would like to process that texels with CUDA and render the result. More about that you can find in this forum thread.
While reading the documentation of registration of graphics resources, I saw the following list of limitations:
- The primary render target may not be registered with CUDA.
- Textures which are not of a format which is 1, 2, or 4 channels of 8, 16, or 32-bit integer or floating-point data cannot be shared.
- Surfaces of depth or stencil formats cannot be shared.
The last two are pretty straight forward for me with my limited knowledge in CUDA and Direct3D.
Does the primary render target refer to the buffer/texture that is used by the swap chain? For example if I create a buffer for my render target view like this
ID3D11Texture2D* texture_rgb; swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&texture_rgb);
texture_rgb the main render target?
Or does primary render target mean what I am currently rendering to? Given following pseudo code
// Create texture as render output ID3D11Texture2D* texture_extra; ... // Create render target view rtv_texture_extra for texture_extra ... // Create depth target view dtv .. // Set current render target device_context->OMSetRenderTargets(1, &rtv_texture_extra, dsv)
texture_extra be the primary render target or is it still
texture_rgb from before?