summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-04-27 21:18:25 +0000
committerBrian Paul <[email protected]>2001-04-27 21:18:25 +0000
commit1832f1cc86758fdcbd122edd5bf9e7a29ccade20 (patch)
treea47ba28e0838612d3b3bf09333a5ef578734c9c7 /src/mesa/drivers/x11
parent75978bd85ea86b4e0a4153d623eaf1d40976f49b (diff)
changed xmesa_visual and xmesa_buffer structs to directly include GLvisual and GLframebuffer structs instead of pointers
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c50
-rw-r--r--src/mesa/drivers/x11/xm_api.c122
-rw-r--r--src/mesa/drivers/x11/xm_dd.c4
-rw-r--r--src/mesa/drivers/x11/xm_line.c4
-rw-r--r--src/mesa/drivers/x11/xmesaP.h10
5 files changed, 88 insertions, 102 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 828896c6baa..abbd528fb0b 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.48 2001/03/23 21:37:05 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.49 2001/04/27 21:18:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -269,16 +269,16 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
if (v->display == dpy
&& v->level == level
&& v->ximage_flag == ximageFlag
- && v->gl_visual->rgbMode == rgbFlag
- && v->gl_visual->doubleBufferMode == dbFlag
- && v->gl_visual->stereoMode == stereoFlag
- && (v->gl_visual->alphaBits > 0) == alphaFlag
- && (v->gl_visual->depthBits >= depth_size || depth_size == 0)
- && (v->gl_visual->stencilBits >= stencil_size || stencil_size == 0)
- && (v->gl_visual->accumRedBits >= accumRedSize || accumRedSize == 0)
- && (v->gl_visual->accumGreenBits >= accumGreenSize || accumGreenSize == 0)
- && (v->gl_visual->accumBlueBits >= accumBlueSize || accumBlueSize == 0)
- && (v->gl_visual->accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
+ && v->mesa_visual.rgbMode == rgbFlag
+ && v->mesa_visual.doubleBufferMode == dbFlag
+ && v->mesa_visual.stereoMode == stereoFlag
+ && (v->mesa_visual.alphaBits > 0) == alphaFlag
+ && (v->mesa_visual.depthBits >= depth_size || depth_size == 0)
+ && (v->mesa_visual.stencilBits >= stencil_size || stencil_size == 0)
+ && (v->mesa_visual.accumRedBits >= accumRedSize || accumRedSize == 0)
+ && (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0)
+ && (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0)
+ && (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
/* now either compare XVisualInfo pointers or visual IDs */
if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
|| (comparePointers && v->vishandle == vinfo)) {
@@ -1418,7 +1418,7 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
*value = glxvis->level;
return 0;
case GLX_RGBA:
- if (glxvis->gl_visual->rgbMode) {
+ if (glxvis->mesa_visual.rgbMode) {
*value = True;
}
else {
@@ -1426,43 +1426,43 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
}
return 0;
case GLX_DOUBLEBUFFER:
- *value = (int) glxvis->gl_visual->doubleBufferMode;
+ *value = (int) glxvis->mesa_visual.doubleBufferMode;
return 0;
case GLX_STEREO:
- *value = (int) glxvis->gl_visual->stereoMode;
+ *value = (int) glxvis->mesa_visual.stereoMode;
return 0;
case GLX_AUX_BUFFERS:
*value = (int) False;
return 0;
case GLX_RED_SIZE:
- *value = glxvis->gl_visual->redBits;
+ *value = glxvis->mesa_visual.redBits;
return 0;
case GLX_GREEN_SIZE:
- *value = glxvis->gl_visual->greenBits;
+ *value = glxvis->mesa_visual.greenBits;
return 0;
case GLX_BLUE_SIZE:
- *value = glxvis->gl_visual->blueBits;
+ *value = glxvis->mesa_visual.blueBits;
return 0;
case GLX_ALPHA_SIZE:
- *value = glxvis->gl_visual->alphaBits;
+ *value = glxvis->mesa_visual.alphaBits;
return 0;
case GLX_DEPTH_SIZE:
- *value = glxvis->gl_visual->depthBits;
+ *value = glxvis->mesa_visual.depthBits;
return 0;
case GLX_STENCIL_SIZE:
- *value = glxvis->gl_visual->stencilBits;
+ *value = glxvis->mesa_visual.stencilBits;
return 0;
case GLX_ACCUM_RED_SIZE:
- *value = glxvis->gl_visual->accumRedBits;
+ *value = glxvis->mesa_visual.accumRedBits;
return 0;
case GLX_ACCUM_GREEN_SIZE:
- *value = glxvis->gl_visual->accumGreenBits;
+ *value = glxvis->mesa_visual.accumGreenBits;
return 0;
case GLX_ACCUM_BLUE_SIZE:
- *value = glxvis->gl_visual->accumBlueBits;
+ *value = glxvis->mesa_visual.accumBlueBits;
return 0;
case GLX_ACCUM_ALPHA_SIZE:
- *value = glxvis->gl_visual->accumAlphaBits;
+ *value = glxvis->mesa_visual.accumAlphaBits;
return 0;
/*
@@ -1485,7 +1485,7 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
}
else if (glxvis->level>0) {
/* overlay */
- if (glxvis->gl_visual->rgbMode) {
+ if (glxvis->mesa_visual.rgbMode) {
*value = GLX_TRANSPARENT_RGB_EXT;
}
else {
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index b115c92295f..5bb7b05f86a 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1,4 +1,4 @@
-/* $Id: xm_api.c,v 1.20 2001/04/10 15:25:45 brianp Exp $ */
+/* $Id: xm_api.c,v 1.21 2001/04/27 21:18:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -425,7 +425,10 @@ static void free_xmesa_buffer(int client, XMesaBuffer buffer)
#endif
}
}
+
+ _mesa_free_framebuffer_data(&buffer->mesa_buffer);
FREE(buffer);
+
return;
}
/* continue search */
@@ -823,8 +826,8 @@ static GLboolean setup_grayscale( int client, XMesaVisual v,
prevBuffer = find_xmesa_buffer(v->display, cmap, buffer);
if (prevBuffer &&
- (buffer->xm_visual->gl_visual->rgbMode ==
- prevBuffer->xm_visual->gl_visual->rgbMode)) {
+ (buffer->xm_visual->mesa_visual.rgbMode ==
+ prevBuffer->xm_visual->mesa_visual.rgbMode)) {
/* Copy colormap stuff from previous XMesaBuffer which uses same
* X colormap. Do this to avoid time spent in noFaultXAllocColor.
*/
@@ -911,8 +914,8 @@ static GLboolean setup_dithered_color( int client, XMesaVisual v,
prevBuffer = find_xmesa_buffer(v->display, cmap, buffer);
if (prevBuffer &&
- (buffer->xm_visual->gl_visual->rgbMode ==
- prevBuffer->xm_visual->gl_visual->rgbMode)) {
+ (buffer->xm_visual->mesa_visual.rgbMode ==
+ prevBuffer->xm_visual->mesa_visual.rgbMode)) {
/* Copy colormap stuff from previous, matching XMesaBuffer.
* Do this to avoid time spent in noFaultXAllocColor.
*/
@@ -1275,10 +1278,8 @@ static GLboolean initialize_visual_and_buffer( int client,
b->frontbuffer = window;
- assert( v->gl_visual );
-
/* Setup for single/double buffering */
- if (v->gl_visual->doubleBufferMode) {
+ if (v->mesa_visual.doubleBufferMode) {
/* Double buffered */
#ifndef XFree86Server
b->shm = check_for_xshm( v->display );
@@ -1569,23 +1570,16 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
if (alpha_flag && alpha_bits == 0)
alpha_bits = 8;
- v->gl_visual = _mesa_create_visual( rgb_flag, db_flag, stereo_flag,
- red_bits, green_bits,
- blue_bits, alpha_bits,
- v->index_bits,
- depth_size,
- stencil_size,
- accum_red_size, accum_green_size,
- accum_blue_size, accum_alpha_size,
- 0 );
- if (!v->gl_visual) {
-#ifndef XFree86Server
- FREE(v->visinfo);
-#endif
- FREE(v);
- return NULL;
- }
-
+ _mesa_initialize_visual( &v->mesa_visual,
+ rgb_flag, db_flag, stereo_flag,
+ red_bits, green_bits,
+ blue_bits, alpha_bits,
+ v->index_bits,
+ depth_size,
+ stencil_size,
+ accum_red_size, accum_green_size,
+ accum_blue_size, accum_alpha_size,
+ 0 );
return v;
}
@@ -1598,7 +1592,6 @@ void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v )
void XMesaDestroyVisual( XMesaVisual v )
{
- _mesa_destroy_visual( v->gl_visual );
#ifndef XFree86Server
FREE(v->visinfo);
#endif
@@ -1632,7 +1625,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
return NULL;
}
- ctx = c->gl_ctx = _mesa_create_context( v->gl_visual,
+ ctx = c->gl_ctx = _mesa_create_context( &v->mesa_visual,
share_list ? share_list->gl_ctx : (GLcontext *) NULL,
(void *) c, direct );
if (!c->gl_ctx) {
@@ -1797,7 +1790,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
#endif
/* determine back buffer implementation */
- if (v->gl_visual->doubleBufferMode) {
+ if (v->mesa_visual.doubleBufferMode) {
if (v->ximage_flag) {
b->db_state = BACK_XIMAGE;
}
@@ -1809,19 +1802,15 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
b->db_state = 0;
}
- b->gl_buffer = _mesa_create_framebuffer( v->gl_visual,
- v->gl_visual->depthBits > 0,
- v->gl_visual->stencilBits > 0,
- v->gl_visual->accumRedBits > 0,
- v->gl_visual->alphaBits > 0 );
- if (!b->gl_buffer) {
- free_xmesa_buffer(client, b);
- return NULL;
- }
+ _mesa_initialize_framebuffer(&b->mesa_buffer,
+ &v->mesa_visual,
+ v->mesa_visual.depthBits > 0,
+ v->mesa_visual.stencilBits > 0,
+ v->mesa_visual.accumRedBits > 0,
+ v->mesa_visual.alphaBits > 0 );
- if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->rgbMode,
+ if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode,
(XMesaDrawable)w, b->cmap )) {
- _mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b);
return NULL;
}
@@ -1833,22 +1822,22 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
int attribs[100];
int numAttribs = 0;
int hw;
- if (v->gl_visual->depthBits > 0) {
+ if (v->mesa_visual.depthBits > 0) {
attribs[numAttribs++] = FXMESA_DEPTH_SIZE;
attribs[numAttribs++] = 1;
}
- if (v->gl_visual->doubleBufferMode) {
+ if (v->mesa_visual.doubleBufferMode) {
attribs[numAttribs++] = FXMESA_DOUBLEBUFFER;
}
- if (v->gl_visual->accumRedBits > 0) {
+ if (v->mesa_visual.accumRedBits > 0) {
attribs[numAttribs++] = FXMESA_ACCUM_SIZE;
- attribs[numAttribs++] = v->gl_visual->accumRedBits;
+ attribs[numAttribs++] = v->mesa_visual.accumRedBits;
}
- if (v->gl_visual->stencilBits > 0) {
+ if (v->mesa_visual.stencilBits > 0) {
attribs[numAttribs++] = FXMESA_STENCIL_SIZE;
- attribs[numAttribs++] = v->gl_visual->stencilBits;
+ attribs[numAttribs++] = v->mesa_visual.stencilBits;
}
- if (v->gl_visual->alphaBits > 0) {
+ if (v->mesa_visual.alphaBits > 0) {
attribs[numAttribs++] = FXMESA_ALPHA_SIZE;
attribs[numAttribs++] = 1;
}
@@ -1939,7 +1928,7 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
b->cmap = cmap;
/* determine back buffer implementation */
- if (v->gl_visual->doubleBufferMode) {
+ if (v->mesa_visual.doubleBufferMode) {
if (v->ximage_flag) {
b->db_state = BACK_XIMAGE;
}
@@ -1951,21 +1940,17 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
b->db_state = 0;
}
- b->gl_buffer = _mesa_create_framebuffer( v->gl_visual,
- v->gl_visual->depthBits > 0,
- v->gl_visual->stencilBits > 0,
- v->gl_visual->accumRedBits +
- v->gl_visual->accumGreenBits +
- v->gl_visual->accumBlueBits > 0,
- v->gl_visual->alphaBits > 0 );
- if (!b->gl_buffer) {
- free_xmesa_buffer(client, b);
- return NULL;
- }
+ _mesa_initialize_framebuffer(&b->mesa_buffer,
+ &v->mesa_visual,
+ v->mesa_visual.depthBits > 0,
+ v->mesa_visual.stencilBits > 0,
+ v->mesa_visual.accumRedBits +
+ v->mesa_visual.accumGreenBits +
+ v->mesa_visual.accumBlueBits > 0,
+ v->mesa_visual.alphaBits > 0 );
- if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->rgbMode,
+ if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode,
(XMesaDrawable)p, cmap)) {
- _mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b);
return NULL;
}
@@ -2022,7 +2007,6 @@ void XMesaDestroyBuffer( XMesaBuffer b )
if (b->xm_context)
b->xm_context->xm_buffer = NULL;
- _mesa_destroy_framebuffer( b->gl_buffer );
free_xmesa_buffer(client, b);
}
@@ -2082,7 +2066,9 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
c->xm_read_buffer = readBuffer;
c->use_read_buffer = (drawBuffer != readBuffer);
- _mesa_make_current2(c->gl_ctx, drawBuffer->gl_buffer, readBuffer->gl_buffer);
+ _mesa_make_current2(c->gl_ctx,
+ &drawBuffer->mesa_buffer,
+ &readBuffer->mesa_buffer);
if (c->gl_ctx->Viewport.Width == 0) {
/* initialize viewport to window size */
@@ -2091,7 +2077,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
c->gl_ctx->Scissor.Height = drawBuffer->height;
}
- if (c->xm_visual->gl_visual->rgbMode) {
+ if (c->xm_visual->mesa_visual.rgbMode) {
/*
* Must recompute and set these pixel values because colormap
* can be different for different windows.
@@ -2170,7 +2156,7 @@ GLboolean XMesaForceCurrent(XMesaContext c)
{
if (c) {
if (c->gl_ctx != _mesa_get_current_context()) {
- _mesa_make_current(c->gl_ctx, c->xm_buffer->gl_buffer);
+ _mesa_make_current(c->gl_ctx, &c->xm_buffer->mesa_buffer);
}
}
else {
@@ -2493,7 +2479,7 @@ GLboolean XMesaGetBackBuffer( XMesaBuffer b,
GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
GLint *bytesPerValue, void **buffer )
{
- if ((!b->gl_buffer) || (!b->gl_buffer->DepthBuffer)) {
+ if (!b->mesa_buffer.DepthBuffer) {
*width = 0;
*height = 0;
*bytesPerValue = 0;
@@ -2501,10 +2487,10 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height,
return GL_FALSE;
}
else {
- *width = b->gl_buffer->Width;
- *height = b->gl_buffer->Height;
+ *width = b->mesa_buffer.Width;
+ *height = b->mesa_buffer.Height;
*bytesPerValue = sizeof(GLdepth);
- *buffer = b->gl_buffer->DepthBuffer;
+ *buffer = b->mesa_buffer.DepthBuffer;
return GL_TRUE;
}
}
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index e2c9e80e94a..548ebb0c543 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.22 2001/04/04 21:54:21 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.23 2001/04/27 21:18:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -751,7 +751,7 @@ clear_buffers( GLcontext *ctx, GLbitfield mask,
const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) &&
- xmesa->xm_buffer->gl_buffer->UseSoftwareAlphaBuffers &&
+ xmesa->xm_buffer->mesa_buffer.UseSoftwareAlphaBuffers &&
ctx->Color.ColorMask[ACOMP]) {
_mesa_clear_alpha_buffers(ctx);
}
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index b997f63fdf7..80fa987051d 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -1,4 +1,4 @@
-/* $Id: xm_line.c,v 1.16 2001/01/23 23:39:37 brianp Exp $ */
+/* $Id: xm_line.c,v 1.17 2001/04/27 21:18:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -64,7 +64,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
XMesaDrawable buffer = xmesa->xm_buffer->buffer;
XMesaGC gc = xmesa->xm_buffer->gc;
- if (xmesa->xm_visual->gl_visual->RGBAflag) {
+ if (xmesa->xm_visual->mesa_visual.RGBAflag) {
register int x, y;
const GLubyte *color = vert->color;
unsigned long pixel = xmesa_color_to_pixel( xmesa,
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index 34d07c9e820..aa014d1eab7 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -1,4 +1,4 @@
-/* $Id: xmesaP.h,v 1.20 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: xmesaP.h,v 1.21 2001/04/27 21:18:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -75,10 +75,10 @@ typedef void (*clear_func)( GLcontext *ctx,
/*
- * "Derived" from gl_visual. Basically corresponds to an XVisualInfo.
+ * "Derived" from GLvisual. Basically corresponds to an XVisualInfo.
*/
struct xmesa_visual {
- GLvisual *gl_visual; /* Device independent visual parameters */
+ GLvisual mesa_visual; /* Device independent visual parameters */
XMesaDisplay *display; /* The X11 display */
#ifdef XFree86Server
GLint screen_depth; /* The depth of the screen */
@@ -156,11 +156,11 @@ struct xmesa_context {
/*
- * "Derived" from gl_buffer. Basically corresponds to a GLXDrawable.
+ * "Derived" from GLframebuffer. Basically corresponds to a GLXDrawable.
*/
struct xmesa_buffer {
+ GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */
GLboolean wasCurrent; /* was ever the current buffer? */
- GLframebuffer *gl_buffer; /* depth, stencil, accum, etc buffers */
XMesaVisual xm_visual; /* the X/Mesa visual */
XMesaContext xm_context; /* the context associated with this buffer */