directx – wait for the copy operation from backbuffer to staging buffer in DX11 to finish?

Im hooking the DX11 present call. During each frame present, I’d like to copy the contents of the backbuffer into a CPU buffer. This can be done creating a staging buffer. The contents of the backbuffer are first copied into this staging buffer and then I can map the buffer to copy the contents to the CPU.

My question is, should I call Map() immediately after CopyResource() to wait for the contents of the backbuffer to be fully copied into the staging buffer? What would happen if, instead of calling Map() immediately after CopyResource(), I finish the present call and wait for the next present to check if the copy has finished? If I do this, would there be any conflicts between the swapchain and the copy operation?

I found some sources in which this last approach of not waiting on Map() and keep the swapchain running was followed, but Im not sure if this is correct or not. Maybe this is perfectly handled by directx so I should not worry about it.

Read more here: Source link