r397 - trunk/code/unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Dec 1 06:16:36 EST 2005


Author: icculus
Date: 2005-12-01 06:16:36 -0500 (Thu, 01 Dec 2005)
New Revision: 397

Modified:
   trunk/code/unix/sdl_glimp.c
Log:

r_smp now works as expected with sdl_glimp.c on Mac OS X.



Modified: trunk/code/unix/sdl_glimp.c
===================================================================
--- trunk/code/unix/sdl_glimp.c	2005-12-01 10:59:50 UTC (rev 396)
+++ trunk/code/unix/sdl_glimp.c	2005-12-01 11:16:36 UTC (rev 397)
@@ -75,6 +75,20 @@
 
 #include "unix_glw.h"
 
+
+/* Just hack it for now. */
+#ifdef MACOS_X
+typedef CGLContextObj QGLContext;
+#define GLimp_GetCurrentContext() CGLGetCurrentContext()
+#define GLimp_SetCurrentContext(ctx) CGLSetCurrentContext(ctx)
+#else
+typedef void *QGLContext;
+#define GLimp_GetCurrentContext() (NULL)
+#define GLimp_SetCurrentContext(ctx)
+#endif
+
+static QGLContext opengl_context;
+
 #define	WINDOW_CLASS_NAME	"Quake III: Arena"
 #define	WINDOW_CLASS_NAME_BRIEF	"quake3"
 
@@ -637,6 +651,8 @@
         continue;
     }
 
+    opengl_context = GLimp_GetCurrentContext();
+
     ri.Printf( PRINT_ALL, "Using %d/%d/%d Color bits, %d depth, %d stencil display.\n",
                sdlcolorbits, sdlcolorbits, sdlcolorbits,
                tdepthbits, tstencilbits);
@@ -1081,7 +1097,7 @@
 
 	glimpRenderThread();
 
-	//qglXMakeCurrent( dpy, None, NULL );
+	GLimp_SetCurrentContext(NULL);
 
 	Com_Printf( "Render thread terminating\n" );
 
@@ -1090,6 +1106,17 @@
 
 qboolean GLimp_SpawnRenderThread( void (*function)( void ) )
 {
+	static qboolean warned = qfalse;
+	if (!warned)
+	{
+		Com_Printf("WARNING: You enable r_smp at your own risk!\n");
+		warned = qtrue;
+	}
+
+#if !MACOS_X
+	return qfalse;  /* better safe than sorry for now. */
+#endif
+
 	if (renderThread != NULL)  /* hopefully just a zombie at this point... */
 	{
 		Com_Printf("Already a render thread? Trying to clean it up...\n");
@@ -1146,7 +1173,7 @@
 {
 	void  *data = NULL;
 
-	//qglXMakeCurrent( dpy, None, NULL );
+	GLimp_SetCurrentContext(NULL);
 
 	SDL_LockMutex(smpMutex);
 	{
@@ -1164,7 +1191,7 @@
 	}
 	SDL_UnlockMutex(smpMutex);
 
-	//qglXMakeCurrent( dpy, win, ctx );
+	GLimp_SetCurrentContext(opengl_context);
 
 	return data;
 }
@@ -1179,12 +1206,12 @@
 	}
 	SDL_UnlockMutex(smpMutex);
 
-	//qglXMakeCurrent( dpy, win, ctx );
+	GLimp_SetCurrentContext(opengl_context);
 }
 
 void GLimp_WakeRenderer( void *data )
 {
-	//qglXMakeCurrent( dpy, None, NULL );
+	GLimp_SetCurrentContext(NULL);
 
 	SDL_LockMutex(smpMutex);
 	{




More information about the quake3-commits mailing list