From f39ed52dbf188111d974e9a12a83c39201b33568 Mon Sep 17 00:00:00 2001 From: Gareth Francis Date: Wed, 29 Mar 2023 20:26:47 +0100 Subject: [PATCH] Remove calls to dwmFlush - Were never called before and cause frame drops with opengl renderer --- src/archutils/Win32/GraphicsWindow.cpp | 27 -------------------------- src/archutils/Win32/GraphicsWindow.h | 5 ----- 2 files changed, 32 deletions(-) diff --git a/src/archutils/Win32/GraphicsWindow.cpp b/src/archutils/Win32/GraphicsWindow.cpp index 371b63970d..fa8f61197a 100644 --- a/src/archutils/Win32/GraphicsWindow.cpp +++ b/src/archutils/Win32/GraphicsWindow.cpp @@ -416,19 +416,6 @@ void GraphicsWindow::Initialize( bool bD3D ) // A few things need to be handled differently for D3D. g_bD3D = bD3D; - //keeping xp on life support -- check for vista+ for dwm - if (IsWindowsVistaOrGreater()) - { - hInstanceDwmapi = LoadLibraryA("dwmapi.dll"); - } - - //if we have dwm, get function pointers to the dll functions - if( hInstanceDwmapi != nullptr ) - { - PFN_DwmFlush = (HRESULT (WINAPI *)(VOID))GetProcAddress( hInstanceDwmapi, "DwmFlush" ); - PFN_DwmIsCompositionEnabled = (HRESULT (WINAPI *)(BOOL*))GetProcAddress( hInstanceDwmapi, "DwmIsCompositionEnabled" ); - } - AppInstance inst; do { @@ -509,20 +496,6 @@ void GraphicsWindow::Update() HOOKS->SetHasFocus( g_bHasFocus ); - if (g_CurrentParams.vsync) - { - //if we can use DWM - if( hInstanceDwmapi != nullptr ) - { - BOOL compositeEnabled = true; - PFN_DwmIsCompositionEnabled(&compositeEnabled); - if (compositeEnabled) - { - PFN_DwmFlush(); - } - } - } - if( g_bResolutionChanged && DISPLAY != nullptr ) { //LOG->Warn( "Changing resolution" ); diff --git a/src/archutils/Win32/GraphicsWindow.h b/src/archutils/Win32/GraphicsWindow.h index 70a22b9992..70cb12724b 100644 --- a/src/archutils/Win32/GraphicsWindow.h +++ b/src/archutils/Win32/GraphicsWindow.h @@ -35,11 +35,6 @@ namespace GraphicsWindow void Update(); HWND GetHwnd(); - - //dwm functions for vista+ - static HINSTANCE hInstanceDwmapi = nullptr; - static HRESULT(WINAPI* PFN_DwmIsCompositionEnabled)(BOOL*); - static HRESULT (WINAPI* PFN_DwmFlush)(VOID); }; #endif