File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333
3434#define WIN32_LEAN_AND_MEAN
3535#include < Windows.h>
36+ #include < dxgi1_6.h>
3637#elif defined(Q_OS_LINUX)
3738#include < openssl/ssl.h>
3839#endif
@@ -594,6 +595,18 @@ int main(int argc, char *argv[])
594595 SDL_SetHint (SDL_HINT_VIDEO_X11_FORCE_EGL , " 1" );
595596 qputenv (" QT_XCB_GL_INTEGRATION" , " xcb_egl" );
596597
598+ #ifdef Q_OS_WIN32
599+ // Let us see the true VBlank rather than DWM's approximation. We do this here
600+ // because this API must be called before the first swapchain (which Qt will
601+ // create when the window is displayed). This is supported on Win11 22H2+.
602+ auto fnDXGIDisableVBlankVirtualization =
603+ (decltype (DXGIDisableVBlankVirtualization)*)GetProcAddress (GetModuleHandleW (L" dxgi.dll" ),
604+ " DXGIDisableVBlankVirtualization" );
605+ if (fnDXGIDisableVBlankVirtualization) {
606+ fnDXGIDisableVBlankVirtualization ();
607+ }
608+ #endif
609+
597610#ifdef Q_OS_MACOS
598611 // This avoids using the default keychain for SSL, which may cause
599612 // password prompts on macOS.
You can’t perform that action at this time.
0 commit comments