What happens if the application is in the middle of drawing to the buffer(d3d surface) and the DWM need the buffer to redraw the screen or vice versa?

Is there any synchronization mechanism available?

有帮助吗?

解决方案

Swap chains always have two or more buffers, and at any particular time, DWM owns one of them. If a new frame is not Present()ed by the app by the time a v-blank occurs, DWM redraws the last frame using the buffer it already has. Synchronization can be achieved by saturating the present queue (after 3 or so calls, the next one will block until v-blank), or by manually calling WaitForVBlank. In Windows 8.1, a more robust mechanism is available using IDXGISwapChain2::GetFrameLatencyWaitableObject. There is no way to force DWM to wait for the app since that would hang the whole OS UI.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top