mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
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:
parent
9b1d03d2cc
commit
3bc78ac5d4
1 changed files with 29 additions and 0 deletions
|
@ -2082,6 +2082,11 @@ int32_t gettimerfreq(void)
|
|||
// VIDEO
|
||||
//=================================================================================================
|
||||
|
||||
// DWM stuff
|
||||
static HMODULE hDWMApiDLL = NULL;
|
||||
static BOOL bDWMApiInited = FALSE;
|
||||
HRESULT(WINAPI *aDwmEnableComposition)(UINT);
|
||||
|
||||
// DirectDraw objects
|
||||
static HMODULE hDDrawDLL = 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 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
|
||||
//
|
||||
|
@ -2231,6 +2258,8 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
|||
gammabrightness = 0;
|
||||
}
|
||||
|
||||
ToggleDesktopComposition(c < 16);
|
||||
|
||||
if (!silentvideomodeswitch)
|
||||
initprintf("Setting video mode %dx%d (%d-bit %s)\n",
|
||||
x,y,c, ((fs&1) ? "fullscreen" : "windowed"));
|
||||
|
|
Loading…
Reference in a new issue