X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fx11%2Fxm_tri.c;h=289ce11be62b335a50b2241b56039b3c8843965a;hb=23d31efc167f09d47635352f697ffcb087d3ebbd;hp=9340ea49743c9b2678fea3aa49a7e55d27f398b3;hpb=3cc2f82bb512edbe529aabfd772ece95b18ca839;p=mesa.git diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 9340ea49743..289ce11be62 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 6.5 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -45,7 +45,7 @@ #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0] + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) /**********************************************************************/ @@ -53,6 +53,8 @@ /**********************************************************************/ +#if CHAN_BITS == 8 + /* * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle. */ @@ -1307,8 +1309,10 @@ #include "swrast/s_tritemp.h" +#endif /* CHAN_BITS == 8 */ -#ifdef DEBUG + +#if defined(DEBUG) && CHAN_BITS == 8 extern void _xmesa_print_triangle_func( swrast_tri_func triFunc ); void _xmesa_print_triangle_func( swrast_tri_func triFunc ) { @@ -1425,28 +1429,40 @@ do { \ #endif -static swrast_tri_func get_triangle_func( GLcontext *ctx ) +/** + * Return pointer to line drawing function, or NULL if we should use a + * swrast fallback. + */ +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); - struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) - ctx->DrawBuffer->_ColorDrawBuffers[0][0]; + struct xmesa_renderbuffer *xrb; #ifdef DEBUG triFuncName = NULL; #endif +#if CHAN_BITS == 8 + /* trivial fallback tests */ 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->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; + return (swrast_tri_func) NULL; + + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH @@ -1600,13 +1616,10 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) return (swrast_tri_func) NULL; } } - - return (swrast_tri_func) NULL; - } - else { - /* draw to pixmap */ - return (swrast_tri_func) NULL; } +#endif /* CHAN_BITS == 8 */ + + return (swrast_tri_func) NULL; }