diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 141 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 100 |
2 files changed, 36 insertions, 205 deletions
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 2a09dd85c60..4c09187add3 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.7 2000/11/06 15:52:48 brianp Exp $ */ +/* $Id: xm_line.c,v 1.8 2000/11/06 17:28:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -95,7 +95,8 @@ void xmesa_choose_point( GLcontext *ctx ) XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag + if (ctx->RenderMode == GL_RENDER + && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag && swrast->_RasterMask == 0 && !ctx->Texture._ReallyEnabled && xmesa->xm_buffer->buffer != XIMAGE) { @@ -571,89 +572,6 @@ static void flat_HPCR_z_line( GLcontext *ctx, } -#if 0 -/* - * Examine ctx->Line attributes and set xmesa->xm_buffer->gc1 - * and xmesa->xm_buffer->gc2 appropriately. - */ -static void setup_x_line_options( GLcontext *ctx ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - int i, state, state0, new_state, len, offs; - int tbit; - char *dptr; - int n_segments = 0; - char dashes[20]; - int line_width, line_style; - - /*** Line Stipple ***/ - if (ctx->Line.StippleFlag) { - const int pattern = ctx->Line.StipplePattern; - - dptr = dashes; - state0 = state = ((pattern & 1) != 0); - - /* Decompose the pattern */ - for (i=1,tbit=2,len=1;i<16;++i,tbit=(tbit<<1)) - { - new_state = ((tbit & pattern) != 0); - if (state != new_state) - { - *dptr++ = ctx->Line.StippleFactor * len; - len = 1; - state = new_state; - } - else - ++len; - } - *dptr = ctx->Line.StippleFactor * len; - n_segments = 1 + (dptr - dashes); - - /* ensure an even no. of segments, or X may toggle on/off for consecutive patterns */ - /* if (n_segments & 1) dashes [n_segments++] = 0; value of 0 not allowed in dash list */ - - /* Handle case where line style starts OFF */ - if (state0 == 0) - offs = dashes[0]; - else - offs = 0; - -#if 0 -fprintf (stderr, "input pattern: 0x%04x, offset %d, %d segments:", pattern, offs, n_segments); -for (i = 0; i < n_segments; i++) -fprintf (stderr, " %d", dashes[i]); -fprintf (stderr, "\n"); -#endif - - XMesaSetDashes( xmesa->display, xmesa->xm_buffer->gc1, - offs, dashes, n_segments ); - XMesaSetDashes( xmesa->display, xmesa->xm_buffer->gc2, - offs, dashes, n_segments ); - - line_style = LineOnOffDash; - } - else { - line_style = LineSolid; - } - - /*** Line Width ***/ - line_width = (int) (ctx->Line.Width+0.5F); - if (line_width < 2) { - /* Use fast lines when possible */ - line_width = 0; - } - - /*** Set GC attributes ***/ - XMesaSetLineAttributes( xmesa->display, xmesa->xm_buffer->gc1, - line_width, line_style, CapButt, JoinBevel); - XMesaSetLineAttributes( xmesa->display, xmesa->xm_buffer->gc2, - line_width, line_style, CapButt, JoinBevel); - XMesaSetFillStyle( xmesa->display, xmesa->xm_buffer->gc1, FillSolid ); - XMesaSetFillStyle( xmesa->display, xmesa->xm_buffer->gc2, FillSolid ); -} -#endif - - static swrast_line_func get_line_func( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; @@ -663,11 +581,11 @@ static swrast_line_func get_line_func( GLcontext *ctx ) (void) DitherValues; /* silence unused var warning */ (void) kernel1; /* silence unused var warning */ - if (ctx->Line.SmoothFlag) return (swrast_line_func)NULL; - if (ctx->Texture._ReallyEnabled) return (swrast_line_func)NULL; - if (ctx->Light.ShadeModel!=GL_FLAT) return (swrast_line_func)NULL; - /* X line stippling doesn't match OpenGL stippling */ - if (ctx->Line.StippleFlag==GL_TRUE) 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._ReallyEnabled) return (swrast_line_func) NULL; + if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL; + if (ctx->Line.StippleFlag) return (swrast_line_func) NULL; if (xmesa->xm_buffer->buffer==XIMAGE && swrast->_RasterMask==DEPTH_BIT @@ -689,9 +607,9 @@ static swrast_line_func get_line_func( GLcontext *ctx ) case PF_DITHER_5R6G5B: return flat_DITHER_5R6G5B_z_line; case PF_DITHER: - return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func)NULL; + return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func)NULL; + return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL; case PF_HPCR: return flat_HPCR_z_line; default: @@ -715,26 +633,17 @@ static swrast_line_func get_line_func( GLcontext *ctx ) case PF_DITHER_5R6G5B: return flat_DITHER_5R6G5B_line; case PF_DITHER: - return (depth==8) ? flat_DITHER8_line : (swrast_line_func)NULL; + return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func)NULL; + return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL; case PF_HPCR: return flat_HPCR_line; default: return (swrast_line_func)NULL; } } -#if 0 - /* XXX have to disable this because X's rasterization rules don't match - * software Mesa's. This causes the linehv.c conformance test to fail. - * In the future, we might provide a config option to enable this. - */ - if (xmesa->xm_buffer->buffer!=XIMAGE && ctx->_RasterMask==0) { - setup_x_line_options( ctx ); - return flat_pixmap_line; - } -#endif - return (swrast_line_func)NULL; + + return (swrast_line_func) NULL; } /* Override for the swrast line-selection function. Try to use one @@ -750,11 +659,23 @@ void xmesa_choose_line( GLcontext *ctx ) } -#define XMESA_NEW_POINT (_NEW_POINT|_SWRAST_NEW_RASTERMASK) -#define XMESA_NEW_LINE (_NEW_LINE|_NEW_TEXTURE|_NEW_LIGHT|\ - _NEW_DEPTH|_SWRAST_NEW_RASTERMASK) -#define XMESA_NEW_TRIANGLE (_NEW_POLYGON|_NEW_TEXTURE|_NEW_LIGHT|\ - _SWRAST_NEW_RASTERMASK|_NEW_DEPTH) +#define XMESA_NEW_POINT (_NEW_POINT | \ + _NEW_RENDERMODE | \ + _SWRAST_NEW_RASTERMASK) + +#define XMESA_NEW_LINE (_NEW_LINE | \ + _NEW_TEXTURE | \ + _NEW_LIGHT | \ + _NEW_DEPTH | \ + _NEW_RENDERMODE | \ + _SWRAST_NEW_RASTERMASK) + +#define XMESA_NEW_TRIANGLE (_NEW_POLYGON | \ + _NEW_TEXTURE | \ + _NEW_LIGHT | \ + _NEW_DEPTH | \ + _NEW_RENDERMODE | \ + _SWRAST_NEW_RASTERMASK) /* Extend the software rasterizer with our line/point/triangle diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 3c252650a73..b152e5c8bbc 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.7 2000/11/05 18:26:12 keithw Exp $ */ +/* $Id: xm_tri.c,v 1.8 2000/11/06 17:28:20 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1450,84 +1450,6 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx, } - -#if 0 -/* - * This function is called if we're about to render triangles into an - * X window/pixmap. It sets the polygon stipple pattern if enabled. - */ -static void setup_x_polygon_options( GLcontext *ctx ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - int fill_type; - - if (ctx->Polygon.StippleFlag) { - if (xmesa->xm_buffer->stipple_pixmap == 0) { - /* Allocate polygon stippling stuff once for this context. */ - XMesaBuffer b = xmesa->xm_buffer; - b->stipple_pixmap = XMesaCreatePixmap( xmesa->display, - b->buffer, 32, 32, 1 ); -#ifdef XFree86Server - b->stipple_gc = CreateScratchGC(xmesa->display, 1); -#else - b->stipple_gc = XCreateGC(xmesa->display, b->stipple_pixmap, 0, NULL); -#endif - XMesaSetFunction(xmesa->display, b->stipple_gc, GXcopy); - XMesaSetForeground(xmesa->display, b->stipple_gc, 1); - XMesaSetBackground(xmesa->display, b->stipple_gc, 0); - } - - /* - * NOTE: We don't handle the following here! - * GL_UNPACK_SWAP_BYTES - * GL_UNPACK_LSB_FIRST - */ - /* Copy Mesa stipple pattern to an XImage then to Pixmap */ - { - XMesaImage *stipple_ximage; - GLuint stipple[32]; - int i; - int shift = xmesa->xm_buffer->height % 32; - for (i=0;i<32;i++) { - stipple[31-i] = ctx->PolygonStipple[(i+shift) % 32]; - } -#ifdef XFree86Server - stipple_ximage = XMesaCreateImage(1, 32, 32, (char *)stipple); -#else - stipple_ximage = XCreateImage( xmesa->display, - xmesa->xm_visual->visinfo->visual, - 1, ZPixmap, 0, - (char *)stipple, - 32, 32, 8, 0 ); - stipple_ximage->byte_order = LSBFirst; - stipple_ximage->bitmap_bit_order = LSBFirst; - stipple_ximage->bitmap_unit = 32; -#endif - XMesaPutImage( xmesa->display, - (XMesaDrawable)xmesa->xm_buffer->stipple_pixmap, - xmesa->xm_buffer->stipple_gc, - stipple_ximage, 0, 0, 0, 0, 32, 32 ); - stipple_ximage->data = NULL; - XMesaDestroyImage( stipple_ximage ); - } - - XMesaSetStipple( xmesa->display, xmesa->xm_buffer->gc1, - xmesa->xm_buffer->stipple_pixmap ); - XMesaSetStipple( xmesa->display, xmesa->xm_buffer->gc2, - xmesa->xm_buffer->stipple_pixmap ); - fill_type = FillStippled; - } - else { - fill_type = FillSolid; - } - - XMesaSetFillStyle( xmesa->display, xmesa->xm_buffer->gc1, fill_type ); - XMesaSetFillStyle( xmesa->display, xmesa->xm_buffer->gc2, fill_type ); -} -#endif - - - #ifdef DEBUG void _xmesa_print_triangle_func( swrast_tri_func triFunc ) @@ -1627,8 +1549,9 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) (void) kernel1; - if (ctx->Polygon.SmoothFlag) return (swrast_tri_func)NULL; - if (ctx->Texture._ReallyEnabled) 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._ReallyEnabled) return (swrast_tri_func) NULL; if (xmesa->xm_buffer->buffer==XIMAGE) { if ( ctx->Light.ShadeModel==GL_SMOOTH @@ -1759,20 +1682,7 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) } else { /* draw to pixmap */ -#if 0 - /* XXX have to disable this because X's rasterization rules - * don't match software Mesa's. This causes a buffer invariance - * test failure in the conformance tests. - * In the future, we might provide a config option to enable this. - */ - if (ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0) { - if (ctx->Color.DitherFlag && depth < 24) - return (swrast_tri_func)NULL; - setup_x_polygon_options( ctx ); - return flat_pixmap_triangle; - } -#endif - return (swrast_tri_func)NULL; + return (swrast_tri_func) NULL; } } |