DXGI ALLOW_TEARING vs V-Sync Input Latency
Choosing between DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and
standard Vertical Synchronization (V-Sync) in DirectX fundamentally
shapes how frames are queued, presented, and displayed, directly
impacting input latency. Enabling V-Sync forces frame delivery to align
strictly with the monitor's vertical refresh cycle, ensuring tear-free
images at the cost of back-pressure and input delay. Conversely,
utilizing DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING enables
immediate scanout and unlocks Variable Refresh Rate (VRR) support in
modern flip-model presentation, reducing input latency to the lowest
possible threshold by decoupling rendering from the display's refresh
interval.
The Mechanics of V-Sync Latency
When an application uses standard V-Sync (configured via
IDXGISwapChain::Present with a SyncInterval
greater than 0), the DirectX Graphics Infrastructure (DXGI) and the
Desktop Window Manager (DWM) hold rendered frames until the display
begins its vertical blanking interval (VBlank).
This synchronization mechanism introduces latency through several factors:
- Presentation Alignment Delay: If a frame finishes rendering immediately after a VBlank interval starts, it must wait in the swap chain buffer for the entire duration of the next refresh cycle (up to 16.67ms at 60 Hz or 6.94ms at 144 Hz) before scanout begins.
- Buffer Queue Back-Pressure: To prevent frame drops, V-Sync pipelines typically maintain two or three back buffers. When the GPU renders faster than the display's refresh rate, the rendering thread blocks until a buffer becomes available. This back-pressure causes user inputs to be sampled multiple frames before those inputs are visually reflected on screen, introducing 1 to 3 frames of end-to-end input lag.
- Framerate Drops and Cadence Stutter: When rendering performance falls below the monitor's native refresh rate, V-Sync drops presentation to integer fractions of the refresh rate (e.g., 60 Hz drops to 30 Hz), doubling frame delivery latency and creating noticeable judder.
The Mechanics of DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING
The DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING flag was
introduced to modern flip-model swap chains
(DXGI_SWAP_EFFECT_FLIP_DISCARD and
DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) to eliminate
synchronization delays in borderless and windowed modes. When used in
conjunction with SyncInterval = 0 and the
DXGI_PRESENT_ALLOW_TEARING flag during presentation, the
runtime bypasses the standard VBlank wait state.
The latency implications include:
- Immediate Frame Delivery: The display hardware or the compositor begins scanning out the most recently completed frame immediately. If a new frame finishes rendering mid-scanout, the display transitions to the new frame instantly. This eliminates the wait time for the next VBlank, ensuring that the visual state reflects the latest possible user input.
- Elimination of Pipeline Back-Pressure: Because completed buffers are swapped without waiting for display timing, the CPU and GPU can render unconstrained. The application samples input closer to display time, minimizing the delay between a hardware event (such as a mouse click) and its presentation on screen.
- Variable Refresh Rate (VRR) Operation: On displays
equipped with G-Sync, FreeSync, or HDMI 2.1 VRR,
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARINGis required to allow the monitor to dynamically synchronize its refresh cycles to the application's frame rate. Within the display's VRR range, this configuration provides tear-free visuals alongside the low-latency characteristics of an unsynchronized pipeline.
Direct Latency Comparison
| Characteristic | V-Sync
(SyncInterval >= 1) |
Allow Tearing
(SyncInterval = 0) |
|---|---|---|
| Minimum Display Latency | Full duration until next VBlank interval | Near-zero wait; immediate scanout |
| Buffer Queue State | Prone to queuing up to max swap chain buffers | Minimal queueing; drops unread intermediate frames |
| Behavior When FPS > Refresh Rate | Frame rate capped; maximum queue latency | Unlimited frame rate; lowest possible input latency; visual tearing |
| Behavior When FPS < Refresh Rate | Framerate snaps to divisors; latency spikes | Framerate fluctuates naturally; minimal latency penalty |
| VRR Compatibility | Forces fixed-rate behavior if FPS exceeds max refresh | Required to properly activate VRR without compositor intervention |
Implementation Considerations
To achieve minimum presentation latency without stability issues, specific conditions must be met:
- Operating System and Driver Support:
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARINGrequires Windows 10 or later and compatible display drivers. Applications must query support usingIDXGIFactory5::CheckFeatureSupportwithDXGI_FEATURE_PRESENT_ALLOW_TEARING. - Windowed vs. Exclusive Modes: In legacy exclusive
fullscreen modes, disabling V-Sync implicitly allowed tearing. Under
modern flip modes,
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARINGis essential to achieve equivalent low-latency performance in borderless windowed configurations without incurring DWM composition latency. - Present Flag Matching: The swap chain must be
created with
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING, and individual present calls must passDXGI_PRESENT_ALLOW_TEARINGwith aSyncIntervalof 0. Attempting to present with tearing on an incompatible swap chain or configuration will cause the call to fail withDXGI_ERROR_INVALID_CALL.