I am trying to read back content from a frame buffer and save it in a file.
After a lot of trial and error, I am doing the following (reverse of DX helper function UpdateSubresources)
1) Created committed buffer resource with type : D3D12_HEAP_TYPE_READBACK and state : D3D12_RESOURCE_STATE_COPY_DEST
2) Switch frame buffer to D3D12_RESOURCE_COPY_SOURCE
3) Call GetCopyableFootprint of the committed buffer created in step 1
4) call CopyTextureRegion ( SCR : Framebuffer , DST : committed buffer created in step 1)
5) Switch frame buffer to state it was before
6) Map committed buffer created in step 1
7) copy to image file
8) Unmap committed buffer created in step 1
It works, but is there a better way?