summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-02-15 19:15:33 +0000
committerBrian Paul <[email protected]>2002-02-15 19:15:33 +0000
commit9ac7182ec4558cb0c3a6481c72732f05feb50a60 (patch)
tree08d1621de181c6bf83e0666ec61a3063e9a52061
parent026c036be0cff7921341a6ea66bc99c4c4761557 (diff)
use separate GC for SwapBuffers to avoid colormask problem
-rw-r--r--src/mesa/drivers/x11/xm_api.c35
-rw-r--r--src/mesa/drivers/x11/xm_dd.c7
-rw-r--r--src/mesa/drivers/x11/xmesaP.h7
3 files changed, 30 insertions, 19 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 8e3f978df83..be02e12a4e3 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,10 +1,10 @@
-/* $Id: xm_api.c,v 1.30 2001/11/06 16:01:19 brianp Exp $ */
+/* $Id: xm_api.c,v 1.31 2002/02/15 19:15:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1306,23 +1306,31 @@ static GLboolean initialize_visual_and_buffer( int client,
#endif
XMesaSetFunction( v->display, b->gc, GXcopy );
+ /* cleargc - for glClear() */
+#ifdef XFree86Server
+ b->cleargc = CreateScratchGC(v->display, window->depth);
+#else
+ b->cleargc = XCreateGC( v->display, window, 0, NULL );
+#endif
+ XMesaSetFunction( v->display, b->cleargc, GXcopy );
+
/*
* Don't generate Graphics Expose/NoExpose events in swapbuffers().
* Patch contributed by Michael Pichler May 15, 1995.
*/
#ifdef XFree86Server
- b->cleargc = CreateScratchGC(v->display, window->depth);
+ b->swapgc = CreateScratchGC(v->display, window->depth);
{
CARD32 v[1];
v[0] = FALSE;
- dixChangeGC(NullClient, b->cleargc, GCGraphicsExposures, v, NULL);
+ dixChangeGC(NullClient, b->swapgc, GCGraphicsExposures, v, NULL);
}
#else
gcvalues.graphics_exposures = False;
- b->cleargc = XCreateGC( v->display, window,
+ b->swapgc = XCreateGC( v->display, window,
GCGraphicsExposures, &gcvalues);
#endif
- XMesaSetFunction( v->display, b->cleargc, GXcopy );
+ XMesaSetFunction( v->display, b->swapgc, GXcopy );
/*
* Set fill style and tile pixmap once for all for HPCR stuff
* (instead of doing it each time in clear_color_HPCR_pixmap())
@@ -2022,6 +2030,7 @@ void XMesaDestroyBuffer( XMesaBuffer b )
if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc );
if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc );
+ if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc );
if (b->backimage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
@@ -2396,7 +2405,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
if (b->shm) {
/*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XShmPutImage( b->xm_visual->display, b->frontbuffer,
- b->cleargc,
+ b->swapgc,
b->backimage, 0, 0,
0, 0, b->width, b->height, False );
/*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
@@ -2406,7 +2415,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
{
/*_glthread_LOCK_MUTEX(_xmesa_lock);*/
XMesaPutImage( b->xm_visual->display, b->frontbuffer,
- b->cleargc,
+ b->swapgc,
b->backimage, 0, 0,
0, 0, b->width, b->height );
/*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/
@@ -2418,7 +2427,7 @@ void XMesaSwapBuffers( XMesaBuffer b )
XMesaCopyArea( b->xm_visual->display,
b->backpixmap, /* source drawable */
b->frontbuffer, /* dest. drawable */
- b->cleargc,
+ b->swapgc,
0, 0, b->width, b->height, /* source region */
0, 0 /* dest region */
);
@@ -2462,7 +2471,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
if (b->shm) {
/* XXX assuming width and height aren't too large! */
XShmPutImage( b->xm_visual->display, b->frontbuffer,
- b->cleargc,
+ b->swapgc,
b->backimage, x, yTop,
x, yTop, width, height, False );
/* wait for finished event??? */
@@ -2472,7 +2481,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
{
/* XXX assuming width and height aren't too large! */
XMesaPutImage( b->xm_visual->display, b->frontbuffer,
- b->cleargc,
+ b->swapgc,
b->backimage, x, yTop,
x, yTop, width, height );
}
@@ -2482,7 +2491,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
XMesaCopyArea( b->xm_visual->display,
b->backpixmap, /* source drawable */
b->frontbuffer, /* dest. drawable */
- b->cleargc,
+ b->swapgc,
x, yTop, width, height, /* source region */
x, yTop /* dest region */
);
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index db97f0754dc..2de711562bc 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -1,4 +1,4 @@
-/* $Id: xm_dd.c,v 1.27 2002/02/14 00:40:24 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.28 2002/02/15 19:15:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -267,6 +267,7 @@ index_mask( GLcontext *ctx, GLuint mask )
else {
m = (unsigned long) mask;
}
+ XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->gc, m );
XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->cleargc, m );
}
}
@@ -281,8 +282,7 @@ color_mask(GLcontext *ctx,
int xclass = GET_VISUAL_CLASS(xmesa->xm_visual);
(void) amask;
- if (xmesa->xm_buffer->buffer != XIMAGE
- && (xclass == TrueColor || xclass == DirectColor)) {
+ if (xclass == TrueColor || xclass == DirectColor) {
unsigned long m;
if (rmask && gmask && bmask) {
m = ((unsigned long)~0L);
@@ -293,6 +293,7 @@ color_mask(GLcontext *ctx,
if (gmask) m |= GET_GREENMASK(xmesa->xm_visual);
if (bmask) m |= GET_BLUEMASK(xmesa->xm_visual);
}
+ XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->gc, m );
XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->cleargc, m );
}
}
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 6ff7ae597f6..d0755701fdd 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -1,10 +1,10 @@
-/* $Id: xmesaP.h,v 1.24 2001/09/01 20:23:25 brianp Exp $ */
+/* $Id: xmesaP.h,v 1.25 2002/02/15 19:15:33 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.2
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -190,6 +190,7 @@ struct xmesa_buffer {
XMesaGC gc; /* scratch GC for span, line, tri drawing */
XMesaGC cleargc; /* GC for clearing the color buffer */
+ XMesaGC swapgc; /* GC for swapping the color buffers */
/* The following are here instead of in the XMesaVisual
* because they depend on the window's colormap.