Adds code to disable the Vista/7 DWM when setting OpenGL modes. This buys some OpenGL performance in windowed mode and works around an ATI OpenGL driver bug.

git-svn-id: https://svn.eduke32.com/eduke32@1578 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2010-01-04 06:01:34 +00:00
parent 9b1d03d2cc
commit 3bc78ac5d4

View file

@ -2082,6 +2082,11 @@ int32_t gettimerfreq(void)
// VIDEO // VIDEO
//================================================================================================= //=================================================================================================
// DWM stuff
static HMODULE hDWMApiDLL = NULL;
static BOOL bDWMApiInited = FALSE;
HRESULT(WINAPI *aDwmEnableComposition)(UINT);
// DirectDraw objects // DirectDraw objects
static HMODULE hDDrawDLL = NULL; static HMODULE hDDrawDLL = NULL;
static LPDIRECTDRAW lpDD = NULL; static LPDIRECTDRAW lpDD = NULL;
@ -2134,6 +2139,28 @@ static char system_colours_saved = 0, bw_colours_set = 0;
static int32_t setgammaramp(WORD gt[3][256]); static int32_t setgammaramp(WORD gt[3][256]);
static int32_t getgammaramp(WORD gt[3][256]); static int32_t getgammaramp(WORD gt[3][256]);
static void ToggleDesktopComposition(BOOL compEnable)
{
if (!bDWMApiInited)
{
hDWMApiDLL = LoadLibrary("DWMAPI.DLL");
if (hDWMApiDLL)
{
aDwmEnableComposition = (void *)GetProcAddress(hDWMApiDLL, "DwmEnableComposition");
}
bDWMApiInited = TRUE;
}
if (aDwmEnableComposition)
{
aDwmEnableComposition(compEnable);
if (!silentvideomodeswitch)
{
initprintf("%s desktop composition.\n", (compEnable) ? "Enabling" : "Disabling");
}
}
}
// //
// checkvideomode() -- makes sure the video mode passed is legal // checkvideomode() -- makes sure the video mode passed is legal
// //
@ -2231,6 +2258,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
gammabrightness = 0; gammabrightness = 0;
} }
ToggleDesktopComposition(c < 16);
if (!silentvideomodeswitch) if (!silentvideomodeswitch)
initprintf("Setting video mode %dx%d (%d-bit %s)\n", initprintf("Setting video mode %dx%d (%d-bit %s)\n",
x,y,c, ((fs&1) ? "fullscreen" : "windowed")); x,y,c, ((fs&1) ? "fullscreen" : "windowed"));