Skip to content

Commit 3f5ae6b

Browse files
BinqAdamsclaude
andcommitted
d3d9: fix inverted vsync latch from implicit-swapchain PresentationInterval
The WaitingForImplicitSwapchain latch derived enableVsyncState with a truthiness check on PresentationInterval - but in D3D9, IMMEDIATE is 0x80000000 (nonzero -> latched vsync ON) while DEFAULT (0) presents synchronized (-> latched OFF). Games explicitly requesting IMMEDIATE at device creation were capped to display refresh (first menu, high input latency) until DLFG's force-vsync-off flipped the state on the first interpolated 3D frame. Latch Off only for IMMEDIATE; DEFAULT/ONE/TWO.. FOUR latch On per real D3D9 semantics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 7011b32 commit 3f5ae6b

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/d3d9/d3d9_swapchain.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,18 @@ namespace dxvk {
332332

333333
// NV-DXVK start: DLFG integration
334334
if (RtxOptions::enableVsync() == EnableVsync::WaitingForImplicitSwapchain) {
335-
// save the vsync state when the first swapchain is created, to act as the default
336-
RtxOptions::enableVsyncState = m_presentParams.PresentationInterval ? EnableVsync::On : EnableVsync::Off;
335+
// Save the vsync state when the first swapchain is created, to act as the default.
336+
// D3D9 semantics: D3DPRESENT_INTERVAL_IMMEDIATE (0x80000000) is the only
337+
// "present unsynchronized" request; DEFAULT (0), ONE (1) and TWO..FOUR all
338+
// present synchronized to vblank. A plain truthiness check reads IMMEDIATE
339+
// (nonzero) as vsync-On and DEFAULT (zero) as vsync-Off - both inverted -
340+
// which capped games that explicitly request IMMEDIATE at device creation
341+
// to the display refresh until something else flipped the state (e.g.
342+
// DLFG's force-vsync-off on the first interpolated 3D frame).
343+
RtxOptions::enableVsyncState =
344+
(m_presentParams.PresentationInterval == D3DPRESENT_INTERVAL_IMMEDIATE)
345+
? EnableVsync::Off
346+
: EnableVsync::On;
337347
}
338348
// NV-DXVK end
339349

0 commit comments

Comments
 (0)