/* XXX don't use this, it doesn't dither correctly */ static void draw_points_ANY_pixmap( struct gl_context *ctx, const SWvertex *vert ) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; XMesaGC gc = xmesa->xm_buffer->gc; if (xmesa->xm_visual->mesa_visual.RGBAflag) { register int x, y; const GLubyte *color = vert->color; unsigned long pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3], xmesa->pixelformat); XMesaSetForeground( dpy, gc, pixel ); x = (GLint) vert->win[0]; y = YFLIP( xrb, (GLint) vert->win[1] ); XMesaDrawPoint( dpy, buffer, gc, x, y); } else { /* Color index mode */ register int x, y; XMesaSetForeground( dpy, gc, vert->index ); x = (GLint) vert->win[0]; y = YFLIP( xrb, (GLint) vert->win[1] ); XMesaDrawPoint( dpy, buffer, gc, x, y); } }
void xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, uint x, uint y, uint w, uint h, const float *p) { struct xmesa_surface *xms = xmesa_surface(ps); struct xmesa_renderbuffer *xrb = xms->xrb; if (xrb) { /* this is a front/back color buffer */ GLubyte tmp[MAX_WIDTH * 4]; GLuint i, j; uint w0 = w; GET_CURRENT_CONTEXT(ctx); CLIP_TILE; FLIP(y); for (i = 0; i < h; i++) { for (j = 0; j < w * 4; j++) { UNCLAMPED_FLOAT_TO_UBYTE(tmp[j], p[j]); } xrb->St.Base.PutRow(ctx, &xrb->St.Base, w, x, y - i, tmp, NULL); p += w0 * 4; } #if 0 /* debug: flush */ { XMesaContext xm = XMESA_CONTEXT(ctx); XSync(xm->display, 0); } #endif } else { /* other softpipe surface */ softpipe_put_tile_rgba(ps, x, y, w, h, p); } }
/* Implements glColorMask() */ static void color_mask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf; const int xclass = xmesa->xm_visual->mesa_visual.visualType; (void) amask; if (ctx->DrawBuffer->Name != 0) return; xmbuf = XMESA_BUFFER(ctx->DrawBuffer); if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) { unsigned long m; if (rmask && gmask && bmask) { m = ((unsigned long)~0L); } else { m = 0; if (rmask) m |= GET_REDMASK(xmesa->xm_visual); if (gmask) m |= GET_GREENMASK(xmesa->xm_visual); if (bmask) m |= GET_BLUEMASK(xmesa->xm_visual); } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); XMesaSetPlaneMask( xmesa->display, xmbuf->gc, m ); } }
/** * Implement glCopyPixels for the front color buffer (or back buffer Pixmap) * for the color buffer. Don't support zooming, pixel transfer, etc. * We do support copying from one window to another, ala glXMakeCurrentRead. */ static void intelCopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { #if 0 const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; const XMesaDrawable drawBuffer = xmesa->xm_draw_buffer->buffer; const XMesaDrawable readBuffer = xmesa->xm_read_buffer->buffer; const XMesaGC gc = xmesa->xm_draw_buffer->gc; ASSERT(dpy); ASSERT(gc); if (drawBuffer && /* buffer != 0 means it's a Window or Pixmap */ readBuffer && type == GL_COLOR && (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ ctx->Pixel.ZoomX == 1.0 && /* no zooming */ ctx->Pixel.ZoomY == 1.0) { /* Note: we don't do any special clipping work here. We could, * but X will do it for us. */ srcy = FLIP(xmesa->xm_read_buffer, srcy) - height + 1; desty = FLIP(xmesa->xm_draw_buffer, desty) - height + 1; XCopyArea(dpy, readBuffer, drawBuffer, gc, srcx, srcy, width, height, destx, desty); } #else _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type ); #endif }
/* * This is typically called when the window size changes and we need * to reallocate the buffer's back/depth/stencil/accum buffers. */ PUBLIC void XMesaResizeBuffers( XMesaBuffer b ) { GET_CURRENT_CONTEXT(ctx); XMesaContext xmctx = XMESA_CONTEXT(ctx); if (!xmctx) return; xmesa_check_and_update_buffer_size(xmctx, b); }
static void clear_index( GLcontext *ctx, GLuint index ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); xmesa->clearpixel = (unsigned long) index; XMesaSetForeground( xmesa->display, xmbuf->cleargc, (unsigned long) index ); } }
static void finish_or_flush( struct gl_context *ctx ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { mtx_lock(&_xmesa_lock); XSync( xmesa->display, False ); mtx_unlock(&_xmesa_lock); } }
static void finish_or_flush( struct gl_context *ctx ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { _glthread_LOCK_MUTEX(_xmesa_lock); XSync( xmesa->display, False ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } }
static void clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); GLint i; for (i = 0; i < height; i++) { GLubyte *ptr = PIXEL_ADDR1(xrb, x, y + i); MEMSET( ptr, xmesa->clearpixel, width ); } }
static void clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); GLuint pixel = (GLuint) xmesa->clearpixel; GLint i, j; if (xmesa->swapbytes) { pixel = ((pixel >> 8) & 0x00ff) | ((pixel << 8) & 0xff00); }
XMesaContext XMesaGetCurrentContext( void ) { GET_CURRENT_CONTEXT(ctx); if (ctx) { XMesaContext xmesa = XMESA_CONTEXT(ctx); return xmesa; } else { return 0; } }
static void finish_or_flush( GLcontext *ctx ) { #ifdef XFree86Server /* NOT_NEEDED */ #else const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { _glthread_LOCK_MUTEX(_xmesa_lock); XSync( xmesa->display, False ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } #endif }
/* Set index mask ala glIndexMask */ static void index_mask( GLcontext *ctx, GLuint mask ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); /* not sure this conditional is really needed */ if (xmbuf->backxrb && xmbuf->backxrb->pixmap) { unsigned long m; if (mask==0xffffffff) { m = ((unsigned long)~0L); } else { m = (unsigned long) mask; } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); } }
/** * Clear the front or back color buffer, if it's implemented with a pixmap. */ static void clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); assert(xmbuf); assert(xrb->pixmap); assert(xmesa); assert(xmesa->display); assert(xrb->pixmap); assert(xmbuf->cleargc); XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc, x, xrb->Base.Height - y - height, width, height ); }
static void clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); GLint i; for (i = y; i < y + height; i++) { GLubyte *ptr = PIXEL_ADDR1( xrb, x, i ); int j; const GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0]; if (i & 1) { sptr += 16; } for (j = x; j < x + width; j++) { *ptr = sptr[j&15]; ptr++; } } }
/* Override the swrast point-selection function. Try to use one of * our internal point functions, otherwise fall back to the standard * swrast functions. */ void xmesa_choose_point( struct gl_context *ctx ) { #if 0 XMesaContext xmesa = XMESA_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx); if (ctx->RenderMode == GL_RENDER && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag && swrast->_RasterMask == 0 && ctx->Texture._MaxEnabledTexImageUnit == -1 && xmesa->xm_buffer->buffer != XIMAGE) { swrast->Point = draw_points_ANY_pixmap; } else { _swrast_choose_point( ctx ); } #else _swrast_choose_point( ctx ); #endif }
/** * Draw fast, XOR line with XDrawLine in front color buffer. * WARNING: this isn't fully OpenGL conformant because different pixels * will be hit versus using the other line functions. * Don't use the code in X server GLcore module since we need a wrapper * for the XSetLineAttributes() function call. */ static void xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaGC gc = xmesa->xm_buffer->gc; GET_XRB(xrb); unsigned long pixel = xmesa_color_to_pixel(ctx, vert1->color[0], vert1->color[1], vert1->color[2], vert1->color[3], xmesa->pixelformat); int x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0]; int y0 = YFLIP(xrb, (GLint) vert0->attrib[VARYING_SLOT_POS][1]); int x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0]; int y1 = YFLIP(xrb, (GLint) vert1->attrib[VARYING_SLOT_POS][1]); XMesaSetForeground(dpy, gc, pixel); XMesaSetFunction(dpy, gc, GXxor); XSetLineAttributes(dpy, gc, (int) ctx->Line.Width, LineSolid, CapButt, JoinMiter); XDrawLine(dpy, xrb->pixmap, gc, x0, y0, x1, y1); XMesaSetFunction(dpy, gc, GXcopy); /* this gc is used elsewhere */ }
static void clear_color( GLcontext *ctx, const GLfloat color[4] ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); xmesa->clearpixel = xmesa_color_to_pixel( ctx, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2], xmesa->clearcolor[3], xmesa->xm_visual->undithered_pf ); _glthread_LOCK_MUTEX(_xmesa_lock); XMesaSetForeground( xmesa->display, xmbuf->cleargc, xmesa->clearpixel ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } }
/* * Convert an RGBA color to a pixel value. */ unsigned long xmesa_color_to_pixel(struct gl_context *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat) { XMesaContext xmesa = XMESA_CONTEXT(ctx); switch (pixelFormat) { case PF_Truecolor: { unsigned long p; PACK_TRUECOLOR( p, r, g, b ); return p; } case PF_8A8B8G8R: return PACK_8A8B8G8R( r, g, b, a ); case PF_8A8R8G8B: return PACK_8A8R8G8B( r, g, b, a ); case PF_8R8G8B: /* fall through */ case PF_8R8G8B24: return PACK_8R8G8B( r, g, b ); case PF_5R6G5B: return PACK_5R6G5B( r, g, b ); case PF_Dither_True: /* fall through */ case PF_Dither_5R6G5B: { unsigned long p; PACK_TRUEDITHER(p, 1, 0, r, g, b); return p; } default: _mesa_problem(ctx, "Bad pixel format in xmesa_color_to_pixel"); } return 0; }
/** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. */ static swrast_line_func get_line_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); const struct xmesa_renderbuffer *xrb; if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) 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._MaxEnabledTexImageUnit != -1) 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 (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); if (xrb->ximage && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_Truecolor: return flat_TRUECOLOR_z_line; case PF_8A8B8G8R: return flat_8A8B8G8R_z_line; case PF_8A8R8G8B: return flat_8A8R8G8B_z_line; case PF_8R8G8B: return flat_8R8G8B_z_line; case PF_8R8G8B24: return flat_8R8G8B24_z_line; case PF_5R6G5B: return flat_5R6G5B_z_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_z_line; default: return (swrast_line_func)NULL; } } if (xrb->ximage && swrast->_RasterMask==0 && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_Truecolor: return flat_TRUECOLOR_line; case PF_8A8B8G8R: return flat_8A8B8G8R_line; case PF_8A8R8G8B: return flat_8A8R8G8B_line; case PF_8R8G8B: return flat_8R8G8B_line; case PF_8R8G8B24: return flat_8R8G8B24_line; case PF_5R6G5B: return flat_5R6G5B_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_line; default: return (swrast_line_func)NULL; } } if (ctx->DrawBuffer->_NumColorDrawBuffers == 1 && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT && swrast->_RasterMask == LOGIC_OP_BIT && ctx->Color.LogicOp == GL_XOR && !ctx->Line.StippleFlag && !ctx->Line.SmoothFlag) { return xor_line; } #endif /* CHAN_BITS == 8 */ return (swrast_line_func) NULL; }
static swrast_tri_func get_triangle_func( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); GET_XRB(xrb); #ifdef DEBUG triFuncName = NULL; #endif if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 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; if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL; if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) return (swrast_tri_func) NULL; if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_z_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_z_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_z_triangle); case PF_HPCR: USE(smooth_HPCR_z_triangle); case PF_Dither: if (depth == 8) USE(smooth_DITHER8_z_triangle); else USE(smooth_DITHER_z_triangle); case PF_Lookup: if (depth == 8) USE(smooth_LOOKUP8_z_triangle); else return (swrast_tri_func) NULL; default: 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->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(flat_8R8G8B_z_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_z_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(flat_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_z_triangle); case PF_HPCR: USE(flat_HPCR_z_triangle); case PF_Dither: if (depth == 8) USE(flat_DITHER8_z_triangle); else USE(flat_DITHER_z_triangle); case PF_Lookup: if (depth == 8) USE(flat_LOOKUP8_z_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_triangle); case PF_HPCR: USE(smooth_HPCR_triangle); case PF_Dither: if (depth == 8) USE(smooth_DITHER8_triangle); else USE(smooth_DITHER_triangle); case PF_Lookup: if (depth == 8) USE(smooth_LOOKUP8_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_triangle); case PF_8R8G8B: USE(flat_8R8G8B_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_triangle); case PF_5R6G5B: USE(flat_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_triangle); case PF_HPCR: USE(flat_HPCR_triangle); case PF_Dither: if (depth == 8) USE(flat_DITHER8_triangle); else USE(flat_DITHER_triangle); case PF_Lookup: if (depth == 8) USE(flat_LOOKUP8_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } return (swrast_tri_func) NULL; } else { /* draw to pixmap */ return (swrast_tri_func) NULL; } }
/** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. */ static swrast_tri_func get_triangle_func(struct gl_context *ctx) { #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); const struct xmesa_renderbuffer *xrb; #ifdef DEBUG triFuncName = NULL; #endif /* trivial fallback tests */ if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) 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; if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL; if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) return (swrast_tri_func) NULL; xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]); if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_z_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_z_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_z_triangle); default: 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->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(flat_8R8G8B_z_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_z_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(flat_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_z_triangle); default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_triangle); default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_triangle); case PF_8R8G8B: USE(flat_8R8G8B_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_triangle); case PF_5R6G5B: USE(flat_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_triangle); default: return (swrast_tri_func) NULL; } } } #endif /* CHAN_BITS == 8 */ return (swrast_tri_func) NULL; }