Options for handling pixels in a display surface after calling IDXGISwapChain1::Present1.
ENUM value | presentation mode | MSAA support | buffer count | operation on buffer after present |
---|---|---|---|---|
DISCARD | bitblt (bit block transfer) | true | 1, if buffer count is greater than 1, only first buffer is used | discard |
SEQUENTIAL | bitblt | false | >1 | persist |
FLIP_SEQUENTIAL | flip | false | >1 | persist |
FLIP_DISCARD | flip | false, also doesn’t support partial rendering | 1 | discard |
说明
当使用
DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
和DXGI_SWAP_EFFECT_SEQUENTIAL
,又希望支持MSAA
,必须使用另外一个单独的Render Target
,在该目标上进行MSAA
渲染,并将结果通过ResolveSubresource
到Swap Chain
的Back Buffer
里。DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
性能最好,且支持的特性较多。尽管
flip
模式有一些优势,某些应用仍然会选择bitblt
模式。因为bitblt
模式是混合GDI
和DirectX
展示的唯一方法。
IDXGISwapChain::Present
SyncInterval
对于 bitblt
模式(包括 DXGI_SWAP_EFFECT_DISCARD
, DXGI_SWAP_EFFECT_SEQUENTIAL
),可选值如下:
0 不做同步,立即显示。
1-4 在 1-4 个 vertical blank 后同步显示。
对于 flip
模式(包括 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
),可选值如下:
0 取消前一个展示帧的剩余时间;如果队列中还有新的帧,丢弃当前帧。
1-4 在 1-4 个 vertical blank 后同步显示。
Flip presentation model queue
Suppose the following frames with sync-interval values are queued from oldest (A) to newest (E) before you call Present.
A: 3, B: 0, C: 0, D: 1, E: 0
When you call Present, the runtime shows frame A for only 1 vertical blank interval. The runtime terminates frame A early because of the sync interval 0 in frame B. Then the runtime shows frame D for 1 vertical blank interval, and then frame E until you submit a new presentation. The runtime discards frames B and C.