X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2FXScreenSaverGLView.m;h=265654a1e9b95c54e62b2aa83a91f38f9241f6a3;hb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;hp=bc07c7fbb071301f43d1ce35cb133aff9e6c09a3;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/OSX/XScreenSaverGLView.m b/OSX/XScreenSaverGLView.m index bc07c7fb..265654a1 100644 --- a/OSX/XScreenSaverGLView.m +++ b/OSX/XScreenSaverGLView.m @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 2006, 2007 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -20,6 +20,8 @@ #import "screenhackI.h" #import "xlockmoreI.h" +#import + /* used by the OpenGL screen savers */ extern GLXContext *init_GL (ModeInfo *); @@ -151,6 +153,19 @@ init_GL (ModeInfo *mi) GLint r = 1; aglSetInteger (ctx, AGL_SWAP_INTERVAL, &r); + // Enable multi-threading, if possible. This runs most OpenGL commands + // and GPU management on a second CPU. + { +# ifndef kCGLCEMPEngine +# define kCGLCEMPEngine 313 // Added in MacOS 10.4.8 + XCode 2.4. +# endif + CGLContextObj cctx = CGLGetCurrentContext(); + CGLError err = CGLEnable (cctx, kCGLCEMPEngine); + if (err != kCGLNoError) { + NSLog (@"enabling multi-threaded OpenGL failed: %d", err); + } + } + // Caller expects a pointer to an opaque struct... which it dereferences. // Don't ask me, it's historical... static int blort = -1; @@ -215,7 +230,7 @@ check_agl_error (const char *type) default: e = buf; sprintf (buf, "unknown AGL error %d", (int) i); break; } - NSLog (@"%s AGL error: %s\n", type, e); + NSLog (@"%s AGL error: %s", type, e); exit (1); } @@ -246,6 +261,6 @@ check_gl_error (const char *type) default: e = buf; sprintf (buf, "unknown GL error %d", (int) i); break; } - NSLog (@"%s GL error: %s\n", type, e); + NSLog (@"%s GL error: %s", type, e); exit (1); }