/*
* 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"),
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
- (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]
+ xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped)
/**********************************************************************/
/**********************************************************************/
+#if CHAN_BITS == 8
+
/*
* XImage, smooth, depth-buffered, PF_TRUECOLOR triangle.
*/
if (z < zRow[i]) { \
pRow[i] = (PIXEL_TYPE) p; \
zRow[i] = z; \
- if (span.y == 100) printf("pass\n");\
} \
- else if (span.y == 100) printf("fail\n");\
span.z += span.zStep; \
}
#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 )
{
#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
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;
}