summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-03-21 17:05:03 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-03-21 17:05:03 +0000
commit894844a8d956a0ee5f95836331dc318f49fdb845 (patch)
tree92aab765e7c82edf310ce1a5d3f1b25cfabc5156 /src/mesa/drivers/x11
parent009501642533c7378fc4f061f1abe2ed4473a3f6 (diff)
Implemented support for software-based AUX color buffers.
Only available with Xlib driver for now. Assorted clean-ups related to Draw/ReadBuffer(). Renamed FRONT_LEFT_BIT -> DD_FRONT_LEFT_BIT, etc.
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c23
-rw-r--r--src/mesa/drivers/x11/xm_api.c3
-rw-r--r--src/mesa/drivers/x11/xm_dd.c15
-rw-r--r--src/mesa/drivers/x11/xm_line.c2
-rw-r--r--src/mesa/drivers/x11/xm_tri.c2
5 files changed, 34 insertions, 11 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 4535f8cae0..47882114cf 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -252,7 +252,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
GLint depth_size, GLint stencil_size,
GLint accumRedSize, GLint accumGreenSize,
GLint accumBlueSize, GLint accumAlphaSize,
- GLint level )
+ GLint level, GLint numAuxBuffers )
{
GLboolean ximageFlag = GL_TRUE;
XMesaVisual xmvis;
@@ -287,6 +287,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
XMesaVisual v = VisualTable[i];
if (v->display == dpy
&& v->mesa_visual.level == level
+ && v->mesa_visual.numAuxBuffers == numAuxBuffers
&& v->ximage_flag == ximageFlag
&& v->mesa_visual.rgbMode == rgbFlag
&& v->mesa_visual.doubleBufferMode == dbFlag
@@ -327,6 +328,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
/* add xmvis to the list */
VisualTable[NumVisuals] = xmvis;
NumVisuals++;
+ /* XXX minor hack */
+ xmvis->mesa_visual.numAuxBuffers = numAuxBuffers;
}
return xmvis;
}
@@ -357,7 +360,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
0, /* depth bits */
0, /* stencil bits */
0,0,0,0, /* accum bits */
- vislevel /* level */
+ vislevel, /* level */
+ 0 /* numAux */
);
}
else if (is_usable_visual( visinfo )) {
@@ -374,7 +378,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
0 * sizeof(GLaccum), /* g */
0 * sizeof(GLaccum), /* b */
0 * sizeof(GLaccum), /* a */
- 0 /* level */
+ 0, /* level */
+ 0 /* numAux */
);
}
else {
@@ -392,7 +397,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
8 * sizeof(GLaccum), /* g */
8 * sizeof(GLaccum), /* b */
8 * sizeof(GLaccum), /* a */
- 0 /* level */
+ 0, /* level */
+ 0 /* numAux */
);
}
}
@@ -925,6 +931,7 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
GLint caveat = DONT_CARE;
XMesaVisual xmvis = NULL;
int desiredVisualID = -1;
+ int numAux = 0;
parselist = list;
@@ -957,7 +964,9 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
case GLX_AUX_BUFFERS:
/* ignore */
parselist++;
- parselist++;
+ numAux = *parselist++;
+ if (numAux > MAX_AUX_BUFFERS)
+ return NULL;
break;
case GLX_RED_SIZE:
parselist++;
@@ -1186,7 +1195,7 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
stereo_flag, depth_size, stencil_size,
accumRedSize, accumGreenSize,
- accumBlueSize, accumAlphaSize, level );
+ accumBlueSize, accumAlphaSize, level, numAux );
}
return xmvis;
@@ -1566,7 +1575,7 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
*value = (int) xmvis->mesa_visual.stereoMode;
return 0;
case GLX_AUX_BUFFERS:
- *value = (int) False;
+ *value = xmvis->mesa_visual.numAuxBuffers;
return 0;
case GLX_RED_SIZE:
*value = xmvis->mesa_visual.redBits;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 189fde636e..da2371eb7c 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1602,6 +1602,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
accum_blue_size, accum_alpha_size,
0 );
+ /* XXX minor hack */
v->mesa_visual.level = level;
return v;
}
@@ -1789,6 +1790,8 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
v->mesa_visual.stencilBits > 0,
v->mesa_visual.accumRedBits > 0,
v->mesa_visual.alphaBits > 0 );
+ /* XXX hack */
+ b->mesa_buffer.UseSoftwareAuxBuffers = GL_TRUE;
if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode,
(XMesaDrawable)w, b->cmap )) {
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 1178b71b74..b58188e200 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -41,6 +41,7 @@
#include "xmesaP.h"
#include "array_cache/acache.h"
#include "swrast/swrast.h"
+#include "swrast/s_auxbuffer.h"
#include "swrast/s_context.h"
#include "swrast/s_drawpix.h"
#include "swrast/s_alphabuf.h"
@@ -167,10 +168,11 @@ xmesa_set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
/*
* Now determine front vs back color buffer.
*/
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
target->buffer = target->frontbuffer;
+ xmesa_update_span_funcs(ctx);
}
- else if (bufferBit == BACK_LEFT_BIT) {
+ else if (bufferBit == DD_BACK_LEFT_BIT) {
ASSERT(target->db_state);
if (target->backpixmap) {
/* back buffer is a pixmap */
@@ -184,12 +186,15 @@ xmesa_set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
/* No back buffer!!!! Must be out of memory, use front buffer */
target->buffer = target->frontbuffer;
}
+ xmesa_update_span_funcs(ctx);
}
+ else if (bufferBit & (DD_AUX0_BIT | DD_AUX1_BIT | DD_AUX2_BIT | DD_AUX3_BIT)) {
+ _swrast_use_aux_buffer(ctx, buffer, bufferBit);
+ }
else {
_mesa_problem(ctx, "invalid buffer 0x%x in set_buffer() in xm_dd.c");
return;
}
- xmesa_update_span_funcs(ctx);
}
@@ -1105,7 +1110,9 @@ void xmesa_update_state( GLcontext *ctx, GLuint new_state )
break;
}
- xmesa_update_span_funcs(ctx);
+ if (ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
+ xmesa_update_span_funcs(ctx);
+ }
}
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index 342528dbef..a5352d6147 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -492,6 +492,8 @@ static swrast_line_func get_line_func( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
+ if ((ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ return (swrast_line_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL;
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 868bca4937..f018a6acac 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1313,6 +1313,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
triFuncName = NULL;
#endif
+ if ((ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ return (swrast_tri_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;