Merge branch 'gallium-0.1' into gallium-0.2
[mesa.git] / src / gallium / winsys / xlib / fakeglx.c
index 902a7550754d9820f57bd9503888d14822dcf23d..2c0075e93454c14b1edbe2df27009fc54cde9f6e 100644 (file)
@@ -1459,6 +1459,13 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
                             GLXDrawable read, GLXContext ctx )
 {
    struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
+   static boolean firsttime = 1, no_rast = 0;
+
+   if (firsttime) {
+      no_rast = getenv("SP_NO_RAST") != NULL;
+      firsttime = 0;
+   }
+
 
    if (ctx && draw && read) {
       XMesaBuffer drawBuffer, readBuffer;
@@ -1504,6 +1511,14 @@ Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
 #endif
       }
 
+      if (no_rast &&
+          MakeCurrent_PrevContext == ctx &&
+          MakeCurrent_PrevDrawable == draw &&
+          MakeCurrent_PrevReadable == read &&
+          MakeCurrent_PrevDrawBuffer == drawBuffer &&
+          MakeCurrent_PrevReadBuffer == readBuffer)
+         return True;
+          
       MakeCurrent_PrevContext = ctx;
       MakeCurrent_PrevDrawable = draw;
       MakeCurrent_PrevReadable = read;
@@ -1674,6 +1689,15 @@ static void
 Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
 {
    XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
+   static boolean firsttime = 1, no_rast = 0;
+
+   if (firsttime) {
+      no_rast = getenv("SP_NO_RAST") != NULL;
+      firsttime = 0;
+   }
+
+   if (no_rast)
+      return;
 
    if (buffer) {
       XMesaSwapBuffers(buffer);