diff options
author | Keith Whitwell <[email protected]> | 2000-11-05 18:26:12 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2000-11-05 18:26:12 +0000 |
commit | ec0585883a85a495d94e24970d64e5d6fc889147 (patch) | |
tree | e33f8668e6fd6682ba865b7f0c418887e83fa579 /src/mesa/drivers/x11/xm_tri.c | |
parent | cd03ed4f54444d96e4e47cdb118a3dfd94d92bb0 (diff) |
Use the new software rasterizer. Reworked optimized line,tri,point
functions to fit into the framework provided for extending the
software rasterizer.
Diffstat (limited to 'src/mesa/drivers/x11/xm_tri.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 443 |
1 files changed, 259 insertions, 184 deletions
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 6d60e31a72d..3c252650a73 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.6 2000/10/31 18:09:47 keithw Exp $ */ +/* $Id: xm_tri.c,v 1.7 2000/11/05 18:26:12 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,7 +41,9 @@ /* Internal swrast includes: */ +#include "swrast/s_context.h" #include "swrast/s_depth.h" +#include "swrast/s_triangle.h" @@ -57,36 +59,34 @@ * no raster ops. */ static void flat_pixmap_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - struct vertex_buffer *VB = ctx->VB; XMesaPoint p[3]; XMesaGC gc; - if (0 /*VB->MonoColor*/) { - gc = xmesa->xm_buffer->gc1; /* use current color */ - } - else { + { unsigned long pixel; if (xmesa->xm_visual->gl_visual->RGBAflag) { pixel = xmesa_color_to_pixel( xmesa, - VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], - VB->ColorPtr->data[pv][2], VB->ColorPtr->data[pv][3], + v0->color[0], v0->color[1], + v0->color[2], v0->color[3], xmesa->pixelformat ); } else { - pixel = VB->IndexPtr->data[pv]; + pixel = v0->index; } gc = xmesa->xm_buffer->gc2; XMesaSetForeground( xmesa->display, gc, pixel ); } - p[0].x = (GLint) (VB->Win.data[v0][0] + 0.5f); - p[0].y = FLIP( xmesa->xm_buffer, (GLint) (VB->Win.data[v0][1] - 0.5f) ); - p[1].x = (GLint) (VB->Win.data[v1][0] + 0.5f); - p[1].y = FLIP( xmesa->xm_buffer, (GLint) (VB->Win.data[v1][1] - 0.5f) ); - p[2].x = (GLint) (VB->Win.data[v2][0] + 0.5f); - p[2].y = FLIP( xmesa->xm_buffer, (GLint) (VB->Win.data[v2][1] - 0.5f) ); + p[0].x = (GLint) (v0->win[0] + 0.5f); + p[0].y = FLIP( xmesa->xm_buffer, (GLint) (v0->win[1] - 0.5f) ); + p[1].x = (GLint) (v1->win[0] + 0.5f); + p[1].y = FLIP( xmesa->xm_buffer, (GLint) (v1->win[1] - 0.5f) ); + p[2].x = (GLint) (v2->win[0] + 0.5f); + p[2].y = FLIP( xmesa->xm_buffer, (GLint) (v2->win[1] - 0.5f) ); XMesaFillPolygon( xmesa->display, xmesa->xm_buffer->buffer, gc, p, 3, Convex, CoordModeOrigin ); } @@ -97,12 +97,12 @@ static void flat_pixmap_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle. */ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -132,11 +132,11 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_8A8B8G8R triangle. */ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -166,11 +166,11 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_8R8G8B triangle. */ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -200,11 +200,11 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_8R8G8B24 triangle. */ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -236,12 +236,12 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_TRUEDITHER triangle. */ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -270,11 +270,11 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_5R6G5B triangle. */ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -304,11 +304,11 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_DITHER_5R6G5B triangle. */ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -338,11 +338,11 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle. */ static void smooth_DITHER8_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -373,12 +373,12 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx, * XImage, smooth, depth-buffered, PF_DITHER triangle. */ static void smooth_DITHER_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -409,11 +409,12 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx, /* * XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle. */ -static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -444,11 +445,12 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle. */ -static void smooth_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_HPCR_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -478,8 +480,9 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, * XImage, flat, depth-buffered, PF_TRUECOLOR triangle. */ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, - GLuint pv ) + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; @@ -487,7 +490,7 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ unsigned long pixel; \ - PACK_TRUECOLOR(pixel, VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2]); + PACK_TRUECOLOR(pixel, v0->color[0], v0->color[1], v0->color[2]); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -509,8 +512,10 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, /* * XImage, flat, depth-buffered, PF_8A8B8G8R triangle. */ -static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) +static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -519,8 +524,8 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0, #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_8B8G8R( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_8B8G8R( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ @@ -541,8 +546,10 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0, /* * XImage, flat, depth-buffered, PF_8R8G8B triangle. */ -static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_8R8G8B_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -551,8 +558,8 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_8R8G8B( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_8R8G8B( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ @@ -573,11 +580,13 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, PF_8R8G8B24 triangle. */ -static void flat_8R8G8B24_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_8R8G8B24_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = ctx->VB->ColorPtr->data[pv]; + const GLubyte *color = v0->color; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) @@ -606,8 +615,10 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, PF_TRUEDITHER triangle. */ -static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; @@ -621,8 +632,8 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLdepth z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ unsigned long p; \ - PACK_TRUEDITHER( p, xx, yy, VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); \ + PACK_TRUEDITHER( p, xx, yy, v0->color[0], \ + v0->color[1], v0->color[2] ); \ XMesaPutPixel( img, xx, yy, p ); \ zRow[i] = z; \ } \ @@ -636,8 +647,10 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, PF_5R6G5B triangle. */ -static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_5R6G5B_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -646,8 +659,8 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_5R6G5B( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_5R6G5B( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ @@ -668,11 +681,13 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, PF_DITHER_5R6G5B triangle. */ -static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) +static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = ctx->VB->ColorPtr->data[pv]; + const GLubyte *color = v0->color; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) @@ -699,8 +714,10 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, /* * XImage, flat, depth-buffered, 8-bit PF_DITHER triangle. */ -static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_DITHER8_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -709,7 +726,7 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -732,15 +749,17 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, PF_DITHER triangle. */ -static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_DITHER_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ - FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -764,8 +783,10 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, 8-bit PF_HPCR triangle. */ -static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_HPCR_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -774,9 +795,9 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - GLubyte r = VB->ColorPtr->data[pv][0]; \ - GLubyte g = VB->ColorPtr->data[pv][1]; \ - GLubyte b = VB->ColorPtr->data[pv][2]; + GLubyte r = v0->color[0]; \ + GLubyte g = v0->color[1]; \ + GLubyte b = v0->color[2]; #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \ @@ -797,8 +818,10 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle. */ -static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_LOOKUP8_z_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 @@ -808,9 +831,9 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ LOOKUP_SETUP; \ - GLubyte r = VB->ColorPtr->data[pv][0]; \ - GLubyte g = VB->ColorPtr->data[pv][1]; \ - GLubyte b = VB->ColorPtr->data[pv][2]; \ + GLubyte r = v0->color[0]; \ + GLubyte g = v0->color[1]; \ + GLubyte b = v0->color[2]; \ GLubyte p = LOOKUP(r,g,b); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -833,12 +856,13 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle. */ -static void smooth_TRUECOLOR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_TRUECOLOR_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -857,11 +881,12 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_8A8B8G8R triangle. */ -static void smooth_8A8B8G8R_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_8A8B8G8R_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -883,11 +908,12 @@ static void smooth_8A8B8G8R_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. */ -static void smooth_8R8G8B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_8R8G8B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -909,11 +935,12 @@ static void smooth_8R8G8B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. */ -static void smooth_8R8G8B24_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_8R8G8B24_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t @@ -937,12 +964,13 @@ static void smooth_8R8G8B24_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_TRUEDITHER triangle. */ -static void smooth_TRUEDITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_TRUEDITHER_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -962,11 +990,12 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_5R6G5B triangle. */ -static void smooth_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_5R6G5B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -988,11 +1017,12 @@ static void smooth_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_DITHER_5R6G5B triangle. */ -static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) +static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -1014,11 +1044,12 @@ static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx, GLuint v0, /* * XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle. */ -static void smooth_DITHER8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_DITHER8_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -1041,12 +1072,14 @@ static void smooth_DITHER8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, PF_DITHER triangle. */ -static void smooth_DITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_DITHER_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - (void) pv; + #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -1066,11 +1099,13 @@ static void smooth_DITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle. */ -static void smooth_LOOKUP8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_LOOKUP8_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; + #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -1094,11 +1129,13 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle. */ -static void smooth_HPCR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void smooth_HPCR_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - (void) pv; + #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -1120,14 +1157,16 @@ static void smooth_HPCR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle. */ -static void flat_TRUECOLOR_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) +static void flat_TRUECOLOR_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define SETUP_CODE \ unsigned long pixel; \ - PACK_TRUECOLOR(pixel, VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2]); + PACK_TRUECOLOR(pixel, v0->color[0], v0->color[1], v0->color[2]); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -1143,16 +1182,18 @@ static void flat_TRUECOLOR_triangle( GLcontext *ctx, GLuint v0, /* * XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle. */ -static void flat_8A8B8G8R_triangle( GLcontext *ctx, GLuint v0, - GLuint v1, GLuint v2, GLuint pv ) +static void flat_8A8B8G8R_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_8B8G8R( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_8B8G8R( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint xx; \ @@ -1168,16 +1209,18 @@ static void flat_8A8B8G8R_triangle( GLcontext *ctx, GLuint v0, /* * XImage, flat, NON-depth-buffered, PF_8R8G8B triangle. */ -static void flat_8R8G8B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_8R8G8B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_8R8G8B( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_8R8G8B( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint xx; \ @@ -1193,11 +1236,13 @@ static void flat_8R8G8B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle. */ -static void flat_8R8G8B24_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_8R8G8B24_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = ctx->VB->ColorPtr->data[pv]; + const GLubyte *color = v0->color; #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -1218,8 +1263,10 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_TRUEDITHER triangle. */ -static void flat_TRUEDITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_TRUEDITHER_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; @@ -1228,8 +1275,8 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLint xx, yy = FLIP(xmesa->xm_buffer, Y); \ for (xx=LEFT;xx<RIGHT;xx++) { \ unsigned long p; \ - PACK_TRUEDITHER( p, xx, yy, VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); \ + PACK_TRUEDITHER( p, xx, yy, v0->color[0], \ + v0->color[1], v0->color[2] ); \ XMesaPutPixel( img, xx, yy, p ); \ } \ } @@ -1241,16 +1288,18 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_5R6G5B triangle. */ -static void flat_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_5R6G5B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - unsigned long p = PACK_5R6G5B( VB->ColorPtr->data[pv][0], \ - VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + unsigned long p = PACK_5R6G5B( v0->color[0], \ + v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint xx; \ @@ -1266,11 +1315,13 @@ static void flat_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle. */ -static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte *color = ctx->VB->ColorPtr->data[pv]; + const GLubyte *color = v0->color; #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -1290,15 +1341,17 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle. */ -static void flat_DITHER8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_DITHER8_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -1316,13 +1369,15 @@ static void flat_DITHER8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, PF_DITHER triangle. */ -static void flat_DITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_DITHER_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define SETUP_CODE \ - FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); + FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] ); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -1340,17 +1395,19 @@ static void flat_DITHER_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle. */ -static void flat_HPCR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_HPCR_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ - GLubyte r = VB->ColorPtr->data[pv][0]; \ - GLubyte g = VB->ColorPtr->data[pv][1]; \ - GLubyte b = VB->ColorPtr->data[pv][2]; + GLubyte r = v0->color[0]; \ + GLubyte g = v0->color[1]; \ + GLubyte b = v0->color[2]; #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint xx, yy = FLIP(xmesa->xm_buffer, Y); \ @@ -1366,8 +1423,10 @@ static void flat_HPCR_triangle( GLcontext *ctx, GLuint v0, GLuint v1, /* * XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle. */ -static void flat_LOOKUP8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ) +static void flat_LOOKUP8_triangle( GLcontext *ctx, + SWvertex *v0, + SWvertex *v1, + SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -1375,9 +1434,9 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx, GLuint v0, GLuint v1, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define SETUP_CODE \ LOOKUP_SETUP; \ - GLubyte r = VB->ColorPtr->data[pv][0]; \ - GLubyte g = VB->ColorPtr->data[pv][1]; \ - GLubyte b = VB->ColorPtr->data[pv][2]; \ + GLubyte r = v0->color[0]; \ + GLubyte g = v0->color[1]; \ + GLubyte b = v0->color[2]; \ GLubyte p = LOOKUP(r,g,b); #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -1468,9 +1527,10 @@ static void setup_x_polygon_options( GLcontext *ctx ) #endif + #ifdef DEBUG void -_xmesa_print_triangle_func( triangle_func triFunc ) +_xmesa_print_triangle_func( swrast_tri_func triFunc ) { printf("XMesa tri func = "); if (triFunc ==smooth_TRUECOLOR_z_triangle) @@ -1559,19 +1619,20 @@ _xmesa_print_triangle_func( triangle_func triFunc ) #endif -triangle_func xmesa_get_triangle_func( GLcontext *ctx ) +static swrast_tri_func get_triangle_func( GLcontext *ctx ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); (void) kernel1; - if (ctx->Polygon.SmoothFlag) return (triangle_func)NULL; - if (ctx->Texture.ReallyEnabled) return (triangle_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 - && ctx->RasterMask==DEPTH_BIT + && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS @@ -1597,13 +1658,13 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) return (depth==8) ? smooth_DITHER8_z_triangle : smooth_DITHER_z_triangle; case PF_LOOKUP: - return (depth==8) ? smooth_LOOKUP8_z_triangle : (triangle_func)NULL; + return (depth==8) ? smooth_LOOKUP8_z_triangle : (swrast_tri_func)NULL; default: - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } } if ( ctx->Light.ShadeModel==GL_FLAT - && ctx->RasterMask==DEPTH_BIT + && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS @@ -1629,12 +1690,12 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) return (depth==8) ? flat_DITHER8_z_triangle : flat_DITHER_z_triangle; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_z_triangle : (triangle_func)NULL; + return (depth==8) ? flat_LOOKUP8_z_triangle : (swrast_tri_func)NULL; default: - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { @@ -1658,13 +1719,13 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) return (depth==8) ? smooth_DITHER8_triangle : smooth_DITHER_triangle; case PF_LOOKUP: - return (depth==8) ? smooth_LOOKUP8_triangle : (triangle_func)NULL; + return (depth==8) ? smooth_LOOKUP8_triangle : (swrast_tri_func)NULL; default: - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { @@ -1688,13 +1749,13 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) return (depth==8) ? flat_DITHER8_triangle : flat_DITHER_triangle; case PF_LOOKUP: - return (depth==8) ? flat_LOOKUP8_triangle : (triangle_func)NULL; + return (depth==8) ? flat_LOOKUP8_triangle : (swrast_tri_func)NULL; default: - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } } - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } else { /* draw to pixmap */ @@ -1704,13 +1765,27 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) * 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->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0) { if (ctx->Color.DitherFlag && depth < 24) - return (triangle_func)NULL; + return (swrast_tri_func)NULL; setup_x_polygon_options( ctx ); return flat_pixmap_triangle; } #endif - return (triangle_func)NULL; + return (swrast_tri_func)NULL; } } + + +/* Override for the swrast tri-selection function. Try to use one + * of our internal tri functions, otherwise fall back to the + * standard swrast functions. + */ +void xmesa_choose_triangle( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (!(swrast->Triangle = get_triangle_func( ctx ))) + _swrast_choose_triangle( ctx ); +} + |