diff options
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 50 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 56 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 151 |
4 files changed, 154 insertions, 107 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index c0d31f47c0..cd49940305 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.44 2001/01/08 04:55:22 keithw Exp $ */ +/* $Id: fakeglx.c,v 1.45 2001/01/23 23:39:37 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->RGBAflag == rgbFlag - && v->gl_visual->DBflag == dbFlag - && v->gl_visual->StereoFlag == 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->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)) { /* now either compare XVisualInfo pointers or visual IDs */ if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) || (comparePointers && v->vishandle == vinfo)) { @@ -1400,7 +1400,7 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, *value = glxvis->level; return 0; case GLX_RGBA: - if (glxvis->gl_visual->RGBAflag) { + if (glxvis->gl_visual->rgbMode) { *value = True; } else { @@ -1408,43 +1408,43 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, } return 0; case GLX_DOUBLEBUFFER: - *value = (int) glxvis->gl_visual->DBflag; + *value = (int) glxvis->gl_visual->doubleBufferMode; return 0; case GLX_STEREO: - *value = (int) glxvis->gl_visual->StereoFlag; + *value = (int) glxvis->gl_visual->stereoMode; return 0; case GLX_AUX_BUFFERS: *value = (int) False; return 0; case GLX_RED_SIZE: - *value = glxvis->gl_visual->RedBits; + *value = glxvis->gl_visual->redBits; return 0; case GLX_GREEN_SIZE: - *value = glxvis->gl_visual->GreenBits; + *value = glxvis->gl_visual->greenBits; return 0; case GLX_BLUE_SIZE: - *value = glxvis->gl_visual->BlueBits; + *value = glxvis->gl_visual->blueBits; return 0; case GLX_ALPHA_SIZE: - *value = glxvis->gl_visual->AlphaBits; + *value = glxvis->gl_visual->alphaBits; return 0; case GLX_DEPTH_SIZE: - *value = glxvis->gl_visual->DepthBits; + *value = glxvis->gl_visual->depthBits; return 0; case GLX_STENCIL_SIZE: - *value = glxvis->gl_visual->StencilBits; + *value = glxvis->gl_visual->stencilBits; return 0; case GLX_ACCUM_RED_SIZE: - *value = glxvis->gl_visual->AccumRedBits; + *value = glxvis->gl_visual->accumRedBits; return 0; case GLX_ACCUM_GREEN_SIZE: - *value = glxvis->gl_visual->AccumGreenBits; + *value = glxvis->gl_visual->accumGreenBits; return 0; case GLX_ACCUM_BLUE_SIZE: - *value = glxvis->gl_visual->AccumBlueBits; + *value = glxvis->gl_visual->accumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: - *value = glxvis->gl_visual->AccumAlphaBits; + *value = glxvis->gl_visual->accumAlphaBits; return 0; /* @@ -1467,7 +1467,7 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, } else if (glxvis->level>0) { /* overlay */ - if (glxvis->gl_visual->RGBAflag) { + if (glxvis->gl_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 e85710e61c..9ef37b54dd 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.15 2001/01/08 04:55:22 keithw Exp $ */ +/* $Id: xm_api.c,v 1.16 2001/01/23 23:39:37 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -822,8 +822,8 @@ static GLboolean setup_grayscale( int client, XMesaVisual v, prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); if (prevBuffer && - (buffer->xm_visual->gl_visual->RGBAflag == - prevBuffer->xm_visual->gl_visual->RGBAflag)) { + (buffer->xm_visual->gl_visual->rgbMode == + prevBuffer->xm_visual->gl_visual->rgbMode)) { /* Copy colormap stuff from previous XMesaBuffer which uses same * X colormap. Do this to avoid time spent in noFaultXAllocColor. */ @@ -910,8 +910,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->RGBAflag == - prevBuffer->xm_visual->gl_visual->RGBAflag)) { + (buffer->xm_visual->gl_visual->rgbMode == + prevBuffer->xm_visual->gl_visual->rgbMode)) { /* Copy colormap stuff from previous, matching XMesaBuffer. * Do this to avoid time spent in noFaultXAllocColor. */ @@ -1277,7 +1277,7 @@ static GLboolean initialize_visual_and_buffer( int client, assert( v->gl_visual ); /* Setup for single/double buffering */ - if (v->gl_visual->DBflag) { + if (v->gl_visual->doubleBufferMode) { /* Double buffered */ #ifndef XFree86Server b->shm = check_for_xshm( v->display ); @@ -1793,7 +1793,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, #endif /* determine back buffer implementation */ - if (v->gl_visual->DBflag) { + if (v->gl_visual->doubleBufferMode) { if (v->ximage_flag) { b->db_state = BACK_XIMAGE; } @@ -1806,16 +1806,16 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } 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 ); + 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; } - if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->RGBAflag, + if (!initialize_visual_and_buffer( client, v, b, v->gl_visual->rgbMode, (XMesaDrawable)w, b->cmap )) { _mesa_destroy_framebuffer( b->gl_buffer ); free_xmesa_buffer(client, b); @@ -1829,22 +1829,22 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, int attribs[100]; int numAttribs = 0; int hw; - if (v->gl_visual->DepthBits > 0) { + if (v->gl_visual->depthBits > 0) { attribs[numAttribs++] = FXMESA_DEPTH_SIZE; attribs[numAttribs++] = 1; } - if (v->gl_visual->DBflag) { + if (v->gl_visual->doubleBufferMode) { attribs[numAttribs++] = FXMESA_DOUBLEBUFFER; } - if (v->gl_visual->AccumRedBits > 0) { + if (v->gl_visual->accumRedBits > 0) { attribs[numAttribs++] = FXMESA_ACCUM_SIZE; - attribs[numAttribs++] = v->gl_visual->AccumRedBits; + attribs[numAttribs++] = v->gl_visual->accumRedBits; } - if (v->gl_visual->StencilBits > 0) { + if (v->gl_visual->stencilBits > 0) { attribs[numAttribs++] = FXMESA_STENCIL_SIZE; - attribs[numAttribs++] = v->gl_visual->StencilBits; + attribs[numAttribs++] = v->gl_visual->stencilBits; } - if (v->gl_visual->AlphaBits > 0) { + if (v->gl_visual->alphaBits > 0) { attribs[numAttribs++] = FXMESA_ALPHA_SIZE; attribs[numAttribs++] = 1; } @@ -1935,7 +1935,7 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, b->cmap = cmap; /* determine back buffer implementation */ - if (v->gl_visual->DBflag) { + if (v->gl_visual->doubleBufferMode) { if (v->ximage_flag) { b->db_state = BACK_XIMAGE; } @@ -1948,18 +1948,18 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, } 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 ); + 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; } - if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->RGBAflag, + if (!initialize_visual_and_buffer(client, v, b, v->gl_visual->rgbMode, (XMesaDrawable)p, cmap)) { _mesa_destroy_framebuffer( b->gl_buffer ); free_xmesa_buffer(client, b); @@ -2087,7 +2087,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, c->gl_ctx->Scissor.Height = drawBuffer->height; } - if (c->xm_visual->gl_visual->RGBAflag) { + if (c->xm_visual->gl_visual->rgbMode) { /* * Must recompute and set these pixel values because colormap * can be different for different windows. diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index e9bbfbca41..b997f63fdf 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.15 2001/01/05 02:26:48 keithw Exp $ */ +/* $Id: xm_line.c,v 1.16 2001/01/23 23:39:37 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -565,7 +565,7 @@ static swrast_line_func get_line_func( GLcontext *ctx ) && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 12f1f49a48..4bb33ce66e 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1,4 +1,4 @@ -/* $Id: xm_tri.c,v 1.16 2001/01/05 02:26:48 keithw Exp $ */ +/* $Id: xm_tri.c,v 1.17 2001/01/23 23:39:37 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1503,6 +1503,25 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc ) #endif +#ifdef DEBUG + +/* record the current triangle function name */ +static const char *triFuncName = NULL; + +#define USE(triFunc) \ +do { \ + triFuncName = #triFunc; \ + /*printf("%s\n", triFuncName);*/ \ + return triFunc; \ +} while (0) + +#else + +#define USE(triFunc) return triFunc + +#endif + + static swrast_tri_func get_triangle_func( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -1511,6 +1530,10 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) (void) kernel1; +#ifdef DEBUG + triFuncName = NULL; +#endif + if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL; @@ -1520,64 +1543,76 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: - return smooth_TRUECOLOR_z_triangle; + USE(smooth_TRUECOLOR_z_triangle); case PF_8A8B8G8R: - return smooth_8A8B8G8R_z_triangle; + USE(smooth_8A8B8G8R_z_triangle); case PF_8R8G8B: - return smooth_8R8G8B_z_triangle; + USE(smooth_8R8G8B_z_triangle); case PF_8R8G8B24: - return smooth_8R8G8B24_z_triangle; + USE(smooth_8R8G8B24_z_triangle); case PF_TRUEDITHER: - return smooth_TRUEDITHER_z_triangle; + USE(smooth_TRUEDITHER_z_triangle); case PF_5R6G5B: - return smooth_5R6G5B_z_triangle; + USE(smooth_5R6G5B_z_triangle); case PF_DITHER_5R6G5B: - return smooth_DITHER_5R6G5B_z_triangle; + USE(smooth_DITHER_5R6G5B_z_triangle); case PF_HPCR: - return smooth_HPCR_z_triangle; + USE(smooth_HPCR_z_triangle); case PF_DITHER: - return (depth==8) ? smooth_DITHER8_z_triangle - : smooth_DITHER_z_triangle; + if (depth == 8) + USE(smooth_DITHER8_z_triangle); + else + USE(smooth_DITHER_z_triangle); + break; case PF_LOOKUP: - return (depth==8) ? smooth_LOOKUP8_z_triangle : (swrast_tri_func)NULL; + if (depth == 8) + USE(smooth_LOOKUP8_z_triangle); + else + return (swrast_tri_func) NULL; default: - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } } if ( ctx->Light.ShadeModel==GL_FLAT && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE - && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: - return flat_TRUECOLOR_z_triangle; + USE(flat_TRUECOLOR_z_triangle); case PF_8A8B8G8R: - return flat_8A8B8G8R_z_triangle; + USE(flat_8A8B8G8R_z_triangle); case PF_8R8G8B: - return flat_8R8G8B_z_triangle; + USE(flat_8R8G8B_z_triangle); case PF_8R8G8B24: - return flat_8R8G8B24_z_triangle; + USE(flat_8R8G8B24_z_triangle); case PF_TRUEDITHER: - return flat_TRUEDITHER_z_triangle; + USE(flat_TRUEDITHER_z_triangle); case PF_5R6G5B: - return flat_5R6G5B_z_triangle; + USE(flat_5R6G5B_z_triangle); case PF_DITHER_5R6G5B: - return flat_DITHER_5R6G5B_z_triangle; + USE(flat_DITHER_5R6G5B_z_triangle); case PF_HPCR: - return flat_HPCR_z_triangle; + USE(flat_HPCR_z_triangle); case PF_DITHER: - return (depth==8) ? flat_DITHER8_z_triangle - : flat_DITHER_z_triangle; + if (depth == 8) + USE(flat_DITHER8_z_triangle); + else + USE(flat_DITHER_z_triangle); + break; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_z_triangle : (swrast_tri_func)NULL; + if (depth == 8) + USE(flat_LOOKUP8_z_triangle); + else + return (swrast_tri_func) NULL; default: - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ @@ -1585,28 +1620,34 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: - return smooth_TRUECOLOR_triangle; + USE(smooth_TRUECOLOR_triangle); case PF_8A8B8G8R: - return smooth_8A8B8G8R_triangle; + USE(smooth_8A8B8G8R_triangle); case PF_8R8G8B: - return smooth_8R8G8B_triangle; + USE(smooth_8R8G8B_triangle); case PF_8R8G8B24: - return smooth_8R8G8B24_triangle; + USE(smooth_8R8G8B24_triangle); case PF_TRUEDITHER: - return smooth_TRUEDITHER_triangle; + USE(smooth_TRUEDITHER_triangle); case PF_5R6G5B: - return smooth_5R6G5B_triangle; + USE(smooth_5R6G5B_triangle); case PF_DITHER_5R6G5B: - return smooth_DITHER_5R6G5B_triangle; + USE(smooth_DITHER_5R6G5B_triangle); case PF_HPCR: - return smooth_HPCR_triangle; + USE(smooth_HPCR_triangle); case PF_DITHER: - return (depth==8) ? smooth_DITHER8_triangle - : smooth_DITHER_triangle; + if (depth == 8) + USE(smooth_DITHER8_triangle); + else + USE(smooth_DITHER_triangle); + break; case PF_LOOKUP: - return (depth==8) ? smooth_LOOKUP8_triangle : (swrast_tri_func)NULL; + if (depth == 8) + USE(smooth_LOOKUP8_triangle); + else + return (swrast_tri_func) NULL; default: - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } } @@ -1615,32 +1656,38 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: - return flat_TRUECOLOR_triangle; + USE(flat_TRUECOLOR_triangle); case PF_TRUEDITHER: - return flat_TRUEDITHER_triangle; + USE(flat_TRUEDITHER_triangle); case PF_8A8B8G8R: - return flat_8A8B8G8R_triangle; + USE(flat_8A8B8G8R_triangle); case PF_8R8G8B: - return flat_8R8G8B_triangle; + USE(flat_8R8G8B_triangle); case PF_8R8G8B24: - return flat_8R8G8B24_triangle; + USE(flat_8R8G8B24_triangle); case PF_5R6G5B: - return flat_5R6G5B_triangle; + USE(flat_5R6G5B_triangle); case PF_DITHER_5R6G5B: - return flat_DITHER_5R6G5B_triangle; + USE(flat_DITHER_5R6G5B_triangle); case PF_HPCR: - return flat_HPCR_triangle; + USE(flat_HPCR_triangle); case PF_DITHER: - return (depth==8) ? flat_DITHER8_triangle - : flat_DITHER_triangle; + if (depth == 8) + USE(flat_DITHER8_triangle); + else + USE(flat_DITHER_triangle); + break; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_triangle : (swrast_tri_func)NULL; + if (depth == 8) + USE(flat_LOOKUP8_triangle); + else + return (swrast_tri_func) NULL; default: - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } } - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } else { /* draw to pixmap */ |