[Xquartz-changes] [324] AppleSGLX/trunk/apple_glx_context.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 26 00:51:58 PDT 2009


Revision: 324
          http://trac.macosforge.org/projects/xquartz/changeset/324
Author:   gstaplin at apple.com
Date:     2009-03-26 00:51:57 -0700 (Thu, 26 Mar 2009)
Log Message:
-----------
Work around an issue with black windows that occurred with some apps when using the
new libGL.  This behavior should be compatible with the old libGL, though it's
not ideal.  See the comments I added with this commit about a unified rendering layer
for more info.

Modified Paths:
--------------
    AppleSGLX/trunk/apple_glx_context.c

Modified: AppleSGLX/trunk/apple_glx_context.c
===================================================================
--- AppleSGLX/trunk/apple_glx_context.c	2009-03-26 07:18:13 UTC (rev 323)
+++ AppleSGLX/trunk/apple_glx_context.c	2009-03-26 07:51:57 UTC (rev 324)
@@ -360,6 +360,27 @@
     
 	/* The drawable is referenced once by apple_glx_surface_create. */
 
+	/*
+	 * FIXME: We actually need 2 references to prevent premature surface 
+	 * destruction.  The problem is that the surface gets destroyed in 
+	 * the case of the context being reused for another window, and
+	 * we then lose the surface contents.  Wait for destruction of a
+	 * window to destroy a surface.
+	 *
+	 * Note: this may leave around surfaces we don't want around, if
+	 * say we are using X for raster drawing after OpenGL rendering, 
+	 * but it will be compatible with the old libGL's behavior.
+	 *
+	 * Someday the X11 and OpenGL rendering must be unified at some
+	 * layer.  I suspect we can do that via shared memory and 
+	 * multiple threads in the X server (1 for each context created
+	 * by a client).  This would also allow users to render from 
+	 * multiple clients to the same OpenGL surface.  In fact it could
+	 * all be OpenGL.
+	 *
+	 */
+	newagd->reference(newagd);
+	
 	/* Save the new drawable with the context structure. */
 	ac->drawable = newagd;
     } else {
@@ -552,7 +573,14 @@
 	     * current in another context.
 	     */
 	    d->destroy(d);
-	}
+	    
+	    /*
+	     * FIXME: We retain 2 references to surfaces to prevent
+	     * premature destruction.  See also: the comment in the
+	     * make current path.
+	     */
+	    d->destroy(d);
+ 	}
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090326/a6f4f043/attachment.html>


More information about the Xquartz-changes mailing list