0

I am faced with the following scenario:

0) I have a compute pipeline which produces output which I would like to be copied verbatim into render targets exposed by the swap chain.

1) In DirectX 11, the compute pipeline could have written directly into a render target exposed by the swapchain, but one cannot do this in DirectX 12 (see discussion here: D3D12 Use backbuffer surface as unordered access view (UAV))

2) Therefore, my compute pipeline will have to write to an output resource X, which is not a render target exposed by the swapchain.

Question: what is the best/easiest way to transfer data from X, to a render target exposed by a swapchain?

There is only one possible solution I am aware of: have a "dummy" graphics pipeline which does nothing apart from take data from X and write it into a render target.

bzm3r
  • 3,113
  • 6
  • 34
  • 67
  • Since you no longer can make a UAV for swapchain backbuffers in DX12, you'll have to use pixel shader to render the content of the compute shader's output to swapchain rendertarget. You can do this by rendering to a fullscreen quad/triangle – rashmatash Jul 01 '19 at 09:56

1 Answers1

0

It is possible to do directly copy from the intermediate buffer (which we decided to call X) into the swapchain image, using CopyTextureRegion. However, according to the discussion here it will be difficult to match the format of the swapchain image and X, and it is best to use a graphics pipeline to do the copy, since it can handle format changes.

bzm3r
  • 3,113
  • 6
  • 34
  • 67