From 2870be2bee2b3b2c421100593ff96a51ead30264 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 2 Nov 2014 23:01:20 +0000 Subject: [PATCH] GL_Init: on OS X, enable multi-threaded OpenGL mode. This moves some of the OpenGL implementation to a background thread, and makes draw calls block for a shorter amount of time. AFAIK, this is the default mode on most other OS'es, not sure why you have to explicitly ask for it on OS X. N.B. the kCGLCEMPEngine constant is available on 10.4+ so I don't bother checking the OS X version. More info: https://developer.apple.com/library/mac/technotes/tn2085/_index.html git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1137 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/gl_vidsdl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index e4a900b4..6f600f97 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -36,6 +36,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "SDL.h" #endif +//ericw -- for putting the driver into multithreaded mode +#ifdef __APPLE__ +#include +#endif + #define MAX_MODE_LIST 600 //johnfitz -- was 30 #define MAX_BPPS_LIST 5 #define WARP_WIDTH 320 @@ -1043,6 +1048,15 @@ static void GL_Init (void) GL_CheckExtensions (); //johnfitz +#ifdef __APPLE__ + // ericw -- enable multi-threaded OpenGL, gives a decent FPS boost. + // see: https://developer.apple.com/library/mac/technotes/tn2085/_index.html + if (kCGLNoError != CGLEnable( CGLGetCurrentContext(), kCGLCEMPEngine)) + { + Con_Warning ("Couldn't enable multi-threaded OpenGL"); + } +#endif + //johnfitz -- intel video workarounds from Baker if (!strcmp(gl_vendor, "Intel")) {