From 193b491b63c5b2f1c6fcca100f747b8fd936be7e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 4 Apr 2015 17:36:55 +0300 Subject: [PATCH] Added control of automatic graphics switching on OS X Automatic graphics switching is enabled by default Set vid_autoswitch CVAR to false to disable it --- src/posix/cocoa/i_video.mm | 10 ++++++++++ src/posix/osx/zdoom-info.plist | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 350202a13c..29e6bf4d4b 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -72,6 +72,11 @@ CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) setmodeneeded = true; } +CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +{ + Printf("You must restart " GAMENAME " to apply graphics switching mode\n"); +} + RenderBufferOptions rbOpts; @@ -399,6 +404,11 @@ CocoaVideo::CocoaVideo(const int multisample) attributes[i++] = NSOpenGLPFAStencilSize; attributes[i++] = NSOpenGLPixelFormatAttribute(8); + if (!vid_autoswitch) + { + attributes[i++] = NSOpenGLPFAAllowOfflineRenderers; + } + if (multisample) { attributes[i++] = NSOpenGLPFAMultisample; diff --git a/src/posix/osx/zdoom-info.plist b/src/posix/osx/zdoom-info.plist index 2a1911cdfa..73be09aa8f 100644 --- a/src/posix/osx/zdoom-info.plist +++ b/src/posix/osx/zdoom-info.plist @@ -43,5 +43,7 @@ NSPrincipalClass NSApplication + NSSupportsAutomaticGraphicsSwitching + YES